ember-cli-simple-auth-token未添加授权头



我看到其他一些人也有这个问题,但我很确定我已经检查了他们的错误。

所以,使用ember-cli-simple-auth和ember-cli-simple-auth-token。我能够很好地验证并访问会话(我可以显示会话)。令牌在我的任何视图一旦登录),但我没有看到"授权"头被设置请求到我的服务器。我有在我的配置:
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.
};

和我的应用程序适配器

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

在这里不知所措;这似乎符合所有的例子

这是版本不匹配的问题。我使用的是最新版本的ember-cli-simple-auth-token,它在session.secure中查找令牌,但使用的是较旧的ember-cli-simple-auth版本,它将令牌存储在session中。

最新更新