使用Facebook的iOS客户端授权以自己的服务器 [英] use facebook iOS client authorization on own to server

查看:150
本文介绍了使用Facebook的iOS客户端授权以自己的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iOS应用使用Facebook的SSO和工作正常的。
现在我想使用该信息 - 在我的服务器后台 - 用户被验证对他的UID的Facebook。但是,我怎么能 - 安全 - ?将此信息传递给服务器

I am using facebook SSO in my iOS app and that works alright. Now I would like to use that information - the user being verified against facebook with his uid - on my server backend. But how can I - securely - pass this information to the server?

我的猜测是,我需要从Facebook发送的uid和大概的authToken我得到了我的服务器?可能有人勾勒的一般方法是什么?

My guess is that I'd need to send the uid and probably the authToken I got from facebook to my server? Could someone outline a general approach to that?

尽管它不应该真正的问题对我的问题,我的服务器运行轨道和设计进行验证。我也有Facebook登录分开工作,但我想在服务器上使用的已进行身份验证从客户端。混乱...

Even though it shouldn't really matter for my question, my server is running rails and devise for authentication. I also have facebook login working there separately, but I want to use the already done authentication from the client on the server. Confusing...

推荐答案

我碰到的 this发布这让我明白的问题和解决方案。

I came across this post which helped me understand the problem and solution.

纠正我,如果你看到任何问题。

Correct me if you see any issues.

我们的想法是在验证令牌传递到Rails应用程序。如果两个应用程序使用相同的应用程序的秘密身份验证令牌才能工作。

The idea is to pass the auth token to the rails app. The auth token only works if both apps use the same app secret.

因此​​,流动是这样的:

So the flow is like this:


  1. 的iOS验证。以用户的Facebook身份验证令牌并传送到Rails应用程序。

  2. Rails应用程序需要身份验证令牌,帖子它graph.facebook.com/?auth_token=XXX。响应应该是用户的JSON对象。

  3. 以用户对象响应找到UID并在你的数据库中的用户相匹配。如果UID不存在,创建一个新用户并设置新的UID。

这篇关于使用Facebook的iOS客户端授权以自己的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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