Facebook iOS SDK和护照 - 脸书认证 [英] Facebook iOS SDK and passport-facebook authentication

查看:176
本文介绍了Facebook iOS SDK和护照 - 脸书认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iOS SDK SDK应用程序上使用passport-facebook实现服务器Facebook身份验证,我不清楚如何在后台设置护照身份验证。



基本上,iOS客户端通过Facebook进行身份验证并获取了sessionToken,并且我想将其传递给passport-facebook / auth / facebook / callback以验证与FB的会话令牌,并通过node.js从我们的数据库中查找用户。



使用护照的方法是正确的,或者我需要通话/ auth / facebook(需要通过什么参数)。 >

此问题提到使用Facebook iOS SDK构建应用程序,然后在服务器上进行身份验证,但并不提及如何执行此操作。



https://github.com/jaredhanson/passport-facebook/issues / 7



我也可以编写自己的自定义护照策略,只需传递FB会话令牌,我可以使用FB图API在服务器上验证FB用户ID并验证它是一个有效的会话,如下所述:
在iOS应用程序中设计Facebook身份验证,还可以访问受保护的Web服务

解决方案/ div>

查看 passport-facebook-token ,该设计旨在基于以前发布的令牌(即发给您的iOS应用程式的令牌)。



护照 - facebook 旨在做网页的流量,通常不是从移动应用程序完成的。


I'm trying to implement server facebook authentication using passport-facebook on an iOS Facebook SDK app, and I'm unclear how to setup the passport authentication on the backend.

Basically the iOS client authenticates with Facebook and gets the sessionToken and I want to pass that to the passport-facebook /auth/facebook/callback to verify the session token with FB, and lookup the user from our database through node.js.

Is that the correct way to use passport-facebook, or do I need call /auth/facebook (and what parameters do I need to pass it).

This issue mentions building an app using Facebook iOS SDK and then authenticating on the server, but doesn't mention exactly how to do that.

https://github.com/jaredhanson/passport-facebook/issues/7

I could also write my own custom passport strategy that simply passes the FB session token and I can verify with FB graph API on the server to get the FB user ID and authenticate it's a valid session, as mentioned here: Design for Facebook authentication in an iOS app that also accesses a secured web service

解决方案

Check out passport-facebook-token, which is designed to authenticate based on a previously issued token (ie, the one issued to your iOS app).

passport-facebook is designed to do the web-based, redirect flow, which is not typically done from a mobile application.

这篇关于Facebook iOS SDK和护照 - 脸书认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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