Facebook iOS SDK and passport-facebook authentication


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.


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

Problem courtesy of: Dougnukem


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.

Solution courtesy of: Jared Hanson


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.