-
Notifications
You must be signed in to change notification settings - Fork 19
Customizing your Authorization Header
Bill Heaton edited this page Jul 16, 2015
·
11 revisions
The example below should work for using ember-simple-auth
.
In your Ember CLI app use ember g mixin authorization
; then configure the
authorizationHeaderStorageKey
used in your localStorage and also redefine the
computed property authorizationCredential
which reads your stored
credentials/token value.
import AuthorizationMixin from 'ember-jsonapi-resources/mixins/authorization';
AuthorizationMixin.reopen({
authorizationHeaderStorageKey: 'ember_simple_auth:session',
authorizationCredential: Ember.computed({
get(key) {
key = this.get('authorizationHeaderStorageKey');
const simpleAuthSession = JSON.parse(window.localStorage.getItem(key));
return 'Bearer ' + simpleAuthSession.secure.access_token;
}
});