1
votes

I've seen that some others have had problems with this as well, but I'm pretty sure I've checked for their mistakes.

So, using ember-cli-simple-auth and ember-cli-simple-auth-token. I am able to authenticate fine and access the session (I can display session.token in any of my views once logged in), but I am not seeing the 'Authorization' header being set on requests to my server. I have in my config:

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

ENV['simple-auth-token'] = {
        serverTokenEndpoint: 'http://localhost:1337/login',
        identificationField: 'email',
        passwordField: 'password',
        tokenPropertyName: 'token',
        authorizationPrefix: 'Bearer ',
        authorizationHeaderName: 'Authorization',
        headers: {},
        refreshAccessTokens: false,
        tokenExpireName: 'expires',
        refreshLeeway: 0,
        timeFactor: 1  // example - set to "1000" to convert incoming seconds to milliseconds.
};

and in my application adapter

import DS from "ember-data";

export default DS.RESTAdapter.extend({
    host: 'http://localhost:1337',
    namespace: 'api/v1',
    coalesceFindRequests: true
});

At a loss here; it seems to conform to all the examples.

1
I believe you've already encountered this issueTim Tonkonogov
Dmitry, I had not seen the issue. However, the solution there is to use crossOriginWhitelist, which I am already using.leejt489

1 Answers

0
votes

This was a version mismatch issue. I was using the newest version of ember-cli-simple-auth-token which was looking for the token in session.secure but an older bower version of ember-cli-simple-auth which was storing the token in session.