Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use refresh token on restore? #249

Closed
bakura10 opened this issue Jul 15, 2014 · 5 comments
Closed

Use refresh token on restore? #249

bakura10 opened this issue Jul 15, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@bakura10
Copy link
Contributor

Hi,

I have an application where the access token is set to 1 day, and refresh token set to 1 month. I've had a user saying to me that he had to relog every day (he didn't manually unlog, just close his browser).

My question is: how Ember Simple Auth behave when the access token expires when the browser is not open? Is Ember Simple Auth smart enough, when someone open the website again, to check if the access token has expired in between, and use the refresh token to try to get a new token?

If that's not the case, that would be awesome to have this work like this. Currently, I just increased drastically the access token lifetime, but I don't really like that!

@marcoow
Copy link
Member

marcoow commented Jul 18, 2014

Can you verify this works?

@marcoow marcoow added the bug label Jul 19, 2014
@marcoow
Copy link
Member

marcoow commented Jul 19, 2014

I see what the problem is - the authenticator only refreshes automatically when no access token is present and not when it is stille present but known to have expired: https://github.com/simplabs/ember-simple-auth/blob/master/packages/ember-simple-auth-oauth2/lib/simple-auth-oauth2/authenticators/oauth2.js#L124.

@marcoow marcoow removed the clarify label Jul 19, 2014
@marcoow marcoow added this to the 0.6.4 milestone Jul 19, 2014
@marcoow marcoow self-assigned this Jul 19, 2014
@bakura10
Copy link
Contributor Author

Interesting. It would make a lot of sense to restore with the refresh token (which may return an error if the refresh token is expired too, but at least it would allow to keep short term token :))

@marcoow
Copy link
Member

marcoow commented Jul 21, 2014

The authenticator will now refresh when the token is known to be expired regardless of whether the access token is present or not.

@marcoow marcoow closed this as completed Jul 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants