-
Notifications
You must be signed in to change notification settings - Fork 74
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
Feature request: redirect / logout on expiration #121
Comments
Second this. I was about to ask if you have any tips on how to handle expiration? My understanding is it'll only be triggered when you try to navigate somewhere, but the token will still exist in storage, so surely all we need to do is redirect if token exists but has expired? If that logic makes sense, I'll try and do a PR for this. |
Cool, thanks for making a PR. |
@apawsey What I did was in authentication.js line 129 If the token has expired in this check a getLogoutRedirect should be added at the top of this file that looks in the config file just like the login redirect does. Otherwise you can just call logout. if (exp) {
In the future I may ask to remain logged in when expiry is approaching and call to renew the token. Similar to banking sites. Hope this helps! |
Has anyone implemented a solution to this? |
@stuartbale aurelia-auth is constantly checking the expire time of the token and you can incorporate your custom logic there. See my above post.
Here you can change the conditional to fit your needs. |
@CD-UNCC @paulvanbladel
Since this aurelia-auth module is strongly based on OAuth, is there anything in the module to help with this pattern? Or is the expectation that all consumers/developers using the module will implement this sort of logic? Thanks, |
Has anyone fixed and/or forked this as yet? |
Updated based on comments in this issue paulvanbladel#121
Love the plugin. I think it would be great to be able to set a redirect or function for when the JWT expires. The Nav bar will update automatically and auth: true routes will vanish. But if you are on an authenticated route when the token expires you can simply remain there.
The text was updated successfully, but these errors were encountered: