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

Hard refresh on invalidationSucceeded #1747

Closed
Redsandro opened this issue Mar 8, 2019 · 4 comments
Closed

Hard refresh on invalidationSucceeded #1747

Redsandro opened this issue Mar 8, 2019 · 4 comments
Labels

Comments

@Redsandro
Copy link

What could cause a hard refresh when a session is invalidated? I would like to prevent a hard refresh from happening, and let my SPA handle the invalidated state.

This is in reference to fenichelar/ember-simple-auth-token#261 where using ember-simple-auth-token causes my app to do a hard refresh when the refresh_token is failing.

It seems to be because invalidationSucceeded is triggered in ember-simple-auth:

https://github.com/simplabs/ember-simple-auth/blob/0ab8847ed94812c391f66f79c645127abd771f95/addon/internal-session.js#L139-L141

There is an example in the code as to how this might be achieved:

https://github.com/simplabs/ember-simple-auth/blob/d6071274d0cb8e3855e24bf2687c1a6395379440/addon/mixins/application-route-mixin.js#L28-L30

But I am not listening to invalidationSucceeded.

Why does my app do a hard refresh? How can I prevent it?

@marcoow
Copy link
Member

marcoow commented Mar 8, 2019

Reloading is ESA's default behavior (see http://ember-simple-auth.com/api/classes/ApplicationRouteMixin.html#method_sessionInvalidated) when the session is invalidated. It is the only way we can reliably make sure all sensitive data is deleted from memory.

@Redsandro
Copy link
Author

@marcoow can I prevent/disable/override that behavior from within Ember?

(At my own risk)

@marcoow
Copy link
Member

marcoow commented Mar 8, 2019

You can simply override the method added by the mixing and not call this._super(...arguments);.

@Redsandro
Copy link
Author

@marcoow thank you.

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