myartsev / ember-simple-auth-jwt

Ember Simple Auth extension for JWT
MIT License
8 stars 3 forks source link

Page refreshes on token-refresh #52

Open Redsandro opened 5 years ago

Redsandro commented 5 years ago

I've switched from a custom implementation to this extension.

The session aught to be refreshed under water, but the entire page refreshes on token-refresh.

Login works fine, but on token-refresh, the page refreshes and I am logged out.

ENV['ember-simple-auth-token'] = {
    serverTokenEndpoint: `${ENV.APP.API_HOST}/api/jwt/login`,
    tokenPropertyName: 'token',
    serverRefreshTokenEndpoint: `${ENV.APP.API_HOST}/api/jwt/token`,
    refreshTokenPropertyName: 'refreshToken',
    refreshAccessTokens: false,
}

What am I doing wrong?

Redsandro commented 5 years ago

I enabled refreshAccessTokens.

    refreshAccessTokens: true,

Apparently, site refreshes on session expire. Why? How can I stop this?

Now the site doesn't refresh, but a request is done to api/token-refresh/.

serverRefreshTokenEndpoint is being ignored.

https://github.com/myartsev/ember-simple-auth-jwt/blob/85306497c17928f05c99b9386be33624437d640e/addon/authenticators/jwt.js#L24-L31

Redsandro commented 5 years ago

There seems to be a parameter spelling discrepancy.

In ember-simple-auth the spelling is serverTokenRefreshEndpoint.

Redsandro commented 5 years ago

This repository has nothing to do with ember-simple-auth-token, does it?