Skip to content

Instantly share code, notes, and snippets.

@jrhe
Created June 6, 2014 21:31
Show Gist options
  • Save jrhe/cb8d92b3ab40b9776b77 to your computer and use it in GitHub Desktop.
Save jrhe/cb8d92b3ab40b9776b77 to your computer and use it in GitHub Desktop.
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
serverTokenEndpoint: ENV.api.host + '/' + ENV.api.namespace + '/oauth/token'
});
// customize the session so that it allows access to the account object
Ember.SimpleAuth.Session.reopen({
user: function() {
var resourceOwnerId = this.get('resource_owner_id');
if (!Ember.isEmpty(resourceOwnerId)) {
return this.container.lookup('store:main').find('user', resourceOwnerId);
}
}.property('resource_owner_id')
});
export default {
name: 'authentication',
initialize: function(container, application) {
Ember.SimpleAuth.setup(container, application, {
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer'
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment