So I realize that the account example here: https://github.com/simplabs/ember-simple-auth/blob/8863c032fcea6148a5b3365be5d66dc2389d301d/examples/4-authenticated-account.html
Provides the code for retrieving the currently logged in account. I just have a few questions about the example as I am trying to get it working in an Ember-CLI app.
SimpleAuth
is being used in the example however, I don't know where it's coming from as I am trying to import SimpleAuth from ...
but I don't know what file to import it from.
Furthermore, I am wondering if the response from the server now needs to return the user_id as well with the access_token/refresh_token?
If so, is that oauth compatible?
EDIT: My current code
// app/initializers/oauth-custom.js
import Ember from 'ember';
import OAuthCustomAuthenticator from 'front/authenticators/oauth-custom';
import Session from 'simple-auth/session';
export default {
name: 'oauth-custom',
before: 'simple-auth',
initialize: function(container) {
Session.reopen({
currentUser: function() {
var user_id = this.get('user_id');
if (!Ember.isEmpty(user_id)) {
return container.lookup('store:main').find('user', user_id);
}
}.property('user_id')
});
container.register(
'oauth-custom:oauth2-password-grant',
OAuthCustomAuthenticator
);
}
};
Authentication works out perfectly, it's just that I don't see any call /user/id that ember tries to make.
Sample response from the server:
{
"access_token": "asdf",
"token_type": "bearer",
"expires": 1406082157,
"expires_in": 604800,
"refresh_token": "asdf",
"user_id": "1"
}