lundi 27 juillet 2015

ember simple-auth-oauth2 token recieved but not stored

I'm running into some problems when using Ember-Simple-Auth with Simple-Auth-OAuth2

I have configured it as per docs and am using the authenticator out of the box as we can customize the back end to fit this.

At the moment when logging in the server returns the correct information, a JSON object

{
access_token: "rAnDomToKEn",
token_type: "Bearer",
expires_in: 45000,
refresh_token: ""
}

I think this what I'd expect to see at this point, however, then the login redirects me to root and if i navigate to a resource, my token does not seem to be sent with the next request.

My login controller is as:

import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';

export default Ember.Controller.extend(LoginControllerMixin, {
    authenticator: 'simple-auth-authenticator:oauth2-password-grant',
});

my config is as:

  ENV['simple-auth-oauth2'] = {
    serverTokenEndpoint: 'http://localhost:3000/token'
  };

  ENV['simple-auth'] = {
    crossOriginWhitelist: ['http://localhost:3000'],
    authorizer: 'simple-auth-authorizer:oauth2-bearer',
    store: 'simple-auth-session-store:local-storage'
  };

I'm sure I'm missing something really obvious here but can't work out what exactly. Any help would be greatly appreciated.

Thanks




Aucun commentaire:

Enregistrer un commentaire