The way I handle redirect after login is that each time I enter /singin route I save the link to previous page on local storage as redirectURL. And it works fine when we only have one tab opened.
But in cases when the user has opened more than on tab, and session timeout on all of them, and user is redirected to /signin page, app rewrites the redirectURL variable for each open tab, which means I’ll have one redirectURL no matter how many opened tab I have.
Is there anyway to tell auth0 to save redirectURL for each page separetly and be able to redirect to it after login?
For example if I have /profile opened in one tab and /reports opened in another tab, after session is timeout and after I login again each of these tabs redirect to their repective path.
Can you give the local storage key a tab id that you can remember which tab it is?
It crossed my mind but as far as I have searched we don’t have such thing as tab identifier.
Edit: I know you’re in angular and that’s for react, but maybe you can shim an angular applicable method out of it.
Thanks a lot for sharing it here @simpleauthority!
Is there any other solution? For example, instead of passing a callback url passing a random string ,while saving it on localstorage associated with a redirect URL. Then when the server does the authticaiton returns that random string which can be used to retrieve proper redirect link from localStorage.
Instead of localStorage, use sessionStorage.