Custom Authentication with LinkedIn

227 views
Skip to first unread message

Brendan OHara

unread,
Jun 15, 2016, 9:41:51 PM6/15/16
to Firebase + EmberJS
Any folks have an example of using the Custom Authentication System with Emberfire & Torii in the new API?

I am specifically only looking to add LinkedIn auth but there do not seem to be any examples out there.

Brendan


Tim Stirrat

unread,
Jun 16, 2016, 2:01:27 PM6/16/16
to Brendan OHara, Firebase + EmberJS
Hey Brendan,

You could look at using auth0.

You'd need to do the following:
- Add Firebase addon to the auth0 app: https://auth0.com/docs/server-apis/firebase
- Enable LinkedIn as an identity provider
- Use auth0 to pop up the lock widget and auth the user
- When done, exchange the auth0 token for a firebase delegation token and throw that into the Firebase custom token method.

Crude example:

// display the lock widget
lock.show({}, (err, profile, id_token) => {

  var options = {
    id_token : id_token,
    api : 'firebase',
    scope : 'openid name email displayName',
    target: 'YOUR-AUTH0-CLIENT-ID'
  };

  // exchange the delegate token for a Firebase auth token
  auth0.getDelegationToken(options, (err, result) => {
    if (!err) {
      
      this.get('session').open('firebase', {provider: 'custom', token: result.id_token})
        .then((result) => {
          // should be authed to firebase and have an active torii session
        });

    }
  });
});

Inspiration was taken from this guide.

Hope that helps,

Tim

--
You received this message because you are subscribed to the Google Groups "Firebase + EmberJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-embe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages