mardi 10 novembre 2015

Ember Simple Auth not setting the Bearer Token

For whatever reason, my authentication seems to be working correctly for logging in, but then I can't got to any routes that use Ember Data. The Bearer Token seems to not be getting set.

Here is my login-form component

import Ember from 'ember';

export default Ember.Component.extend({
  session: Ember.inject.service(),

  actions: {
    authenticate() {
      let { identification, password } = this.getProperties('identification', 'password');
      this.get('session').authenticate('authenticator:oauth2', identification, password)
      .catch((reason) => {
        this.set('errorMessage', reason.error);
        console.log(reason.error);
      });
    }
  }

});

This is my authorizer (lives in app/authorizers/application.js)

import OAuth2Bearer from 'ember-simple-auth/authorizers/oauth2-bearer';

export default OAuth2Bearer.extend();

and this is my authenticator (lives in app/authenticators/oauth2.js)

import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import config from 'contacts/config/environment';

export default OAuth2PasswordGrant.extend({
  serverTokenEndpoint: config.APP.host + '/' + config.APP.namespace + '/authenticate',
});

If anyone see's that I'm missing something, please let me know. Thank you!

Aucun commentaire:

Enregistrer un commentaire