My app access token expires every 10 minutes. I'm using ember simple auth for authentication, but is a custom authenticator, because I have more than just username and password fields. I wanted to use ember-simple-auth-token, but calling to authorization:jwt in my adapter, it doesn't work, apparently is because I'm not using it's authenticator.
So, I was considering to use a service that renew the token every ten minutes, something like this http://ift.tt/1PEILhI, so my question is how to overwrite the sessionData token.
My custom authorizer file code looks like this:
import Ember from 'ember';
import Base from 'ember-simple-auth/authorizers/base';
export default Base.extend({
authorize(sessionData, block) {
if (!Ember.isEmpty(sessionData.token)) {
block('Authorization', 'Bearer '+sessionData.token);
block('Content-Type', 'application/json');
}
}
});
Aucun commentaire:
Enregistrer un commentaire