移动应用Larvel 5 API授权其使用Facebook的授权 [英] Larvel 5 API authorization for mobile applications which uses Facebook for authorization

查看:240
本文介绍了移动应用Larvel 5 API授权其使用Facebook的授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的后端部分的移动应用程序。后端将是一个RESTful API。对我来说,主要的问题 - 这是授权/认证用户

I'm working on back-end part for mobile application. The back-end will be a RESTful API. The main question for me - it's authorization/authentication users.

我们将使用Facebook授权(Facebook的SDK iOS设备)在移动应用方面。这里的主要问题是:怎样只用我们可以从Facebook获取的数据来实现对后端端授权

We will use the Facebook authorization (Facebook SDK for iOS) on the mobile application side. The main question here is: how to implement authorization on back-end side using only data we can get from Facebook?

也许有人已经有了一些解决方案,也可以完成这个任务提供一些例子吗?

Maybe someone already got some solutions or can provide some examples for this task?

我能想象这个过程:


  1. 用户preSS在应用程序中的登录与FB按钮,并得到重定向FB,在那里他批准连接

  1. User press the "Login with FB" button in the application and getting the redirect to FB, where he approve the connect

用户返回到一些数据来自FB(Facebook的用户ID,某些用户数据和授权令牌)

User returns to the application with some data from FB (user Facebook ID, some user data and authorization token)

应用此数据发送到API和尝试注册/验证用户

Application sends this data to the API and trying to register/authenticate the user

API保存授权令牌,然后使用该令牌用于检查用户在应用程序发送的请求API

API save the authorization token and then use this token for check the user when application send the requests to API

我是纠正或这种逻辑是错误的?请指教,如果可能的话提供一些例子。

Am I correct or this logic is wrong? Please advise, and if possible provide some examples.

另外,我发现这个家伙,但不知道这将有助于在我的情况..

Also I'm found this guy, but not sure it will be helpful in my situation...

推荐答案

这个过程看起来不错。只有一件事你必须添加 - 当你进行API调用不包括的 Laravel CSRF令牌

The process looks fine. Only the one thing you have to add - when you make API calls do include Laravel CSRF token.

这篇关于移动应用Larvel 5 API授权其使用Facebook的授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆