HI everyone,
i’m using ember-simple-auth and ember-simple-auth-token to implement a client side session mechanism. My backend is writtend in django(DRF + DRF jwt) and I’m using ember-django-adapter. I defined a route users, a model user but when i try to go to http://myhost/users i have this error:
Error while processing route: users.index Authentication credentials were not provided. Error: Authentication credentials were not provided.
How can i tell to ember django adapter to add a specific authorization token(grabbed from ember-simpe-auth session) when making an http request?
Thank You.
Hi @cresg820,
I use ember-simple-auth with my DRF projects as well, although I’m using the oauth2 flavor. ember-django-adapter should not interfere with any extra headers added by the token authorizer.
Did you configure the authorizer correctly?
e.g.:
// config/environment.js
ENV['simple-auth'] = {
authorizer: 'simple-auth-authorizer:token'
};
HI @dustinfarris,
i’m using ember-cli and i added to config\environment.js this code
ENV['simple-auth'] = {
authorizer: 'simple-auth-authorizer:token'
};
ENV['simple-auth-token'] = {
serverTokenEndpoint: 'http://myhost/api/jwt-auth/',
identificationField: 'username',
tokenPropertyName: 'token',
authorizationPrefix: 'JWT',
authorizationHeaderName: 'Authorization',
};
When I check under Resources → Local Storage(under chrome debug console) I see a key ember_simple_authsession with this value: {“authenticator”:“simple-auth-authenticator:token”,“token”:“xxxxxxxxxx”}.
And if i check under Network → Users → Headers(under chrome debug console) in Request Headers there is no trace about authorization header.
Aha! Well there you go. Glad it was a simple fix.