Ember-simple-auth with passport?


#1

Hi

I am messing about with Node for the 1st time and have an API set up which can authenticate users with local and facebook.

I now want to get my ember app using the /auth/facebook auth on the API - all hints are pointing at ember-simple-auth for doing this but I haven’t got a clue where to begin! I have looked at the docs and understand it all hangs off of the session object but there doesn’t seem to be much info in the way of actually authenticating a user with something like Passport.

Has anyone done this? Are there any examples anywhere?


#2

Hi Wayne, have you had any luck with this? I’m looking for info in this realm as well. Thanks


#3

I did work on a small blogging application a while ago that used ember-simple-auth against an API using Node-Passport.

From what I remember from looking at the code, one of the easiest ways to accomplish this is by implementing your own Authenticator and Authorizer with ember-simple-auth. The README on their GitHub and API docs do well to explain most of it …

Basically the Authenticator is in charge of three main repsonsibilities; authenticating a session, restoring a session and invalidating a session. That is pretty much where you want to implement your AJAX between your ember app and your API auth points.

The authorizer comes into play afterwards by using whatever token data you received from authenticating to wrap subsequent requests with token data to maintain authenticity.


#4

Any code guys to demo this?


#5

Hi I ended up going with the following stack:

and then on the ember side:

  • ember-simple-auth
  • torii - use facebook connect to get the access_token stuff else you’re in a world of pain - only downside here is it doesn’t work with mobile - I am yet to figure this out.

A demo can be seen at http://test.sonatribe.com

If you need any help just ask here and I will try my best :slight_smile:


#6

I would be very much interested to see an example project to see some code.


#7

I almost didn’t post this because the code makes me cringe (this was my first frontend project) but here it is - https://github.com/bttf/ember-blog :cry:

Authentication/authorization code is in app/initializers folder