Search code examples
ember-clifacebook-loginember-simple-auth

fb login through ember-simple-auth


I have to include a fb login in my web app.Now fb login returns a access_token which is send to my backend to get a new token generate by my backend.This new token is now to be send in headers of every api call I make to my backend.Is there a way I can implement this by ember-simple-auth.If Yes please some code

The response from facebook is something like this:

{
    status: 'connected',
    authResponse: {
        accessToken: '...',
        expiresIn:'...',
        signedRequest:'...',
        userID:'...'
    }
}

Solution

  • Check out Ember Simple Auth's dummy app: https://github.com/simplabs/ember-simple-auth#how-do-i-use-it. It implements Facebook auth and also has an example server included.

    The flow goes more or less like this:

    • open the Facebook auth UI (using torii)
    • user logs in and grants access
    • Facebook redirects with an auth code
    • the auth code is posted to the app's server which exchanges it for an app-specific bearer token
    • the bearer token is included in all subsequent requests