-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Redirect to original route after login #615
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
Comments
👍 from me. Or if my token times out while I'm at some view, I'd prefer to either not have to leave the view I'm in (popup login) or at least be taken back after login, since I think OAuth redirection makes a popup hard/impossible. |
@stanleygu in the |
I couldn't figure out how to trigger the route change from the popup. I ended up using a workaround for now where I pass the original route as a query parameter in the callbackURL during passport auth, which comes back and I do the redirect at that point. e.g.
|
I think you can change redirect url In |
@hiromitz, yep that is where I ended up doing my redirect:
However, since that call comes from the OAuth server, the challenge was saving the original destination URL. I ended up sending the original URL to the OAuth server for it to include in the callback URL as a query string, which then gets read inside |
@stanleygu can you provide your solution as a PR? Thank you. |
@stanleygu that's probably how I'd do it as well. IMHO OAuth itself is "kludgey" so you end up having to do some odd things at times. |
Hey Guys, I used ngStorage library to store a requested page to $sessionStorage and UI-Route's state change filtering to restore the page after login or after any other page was loaded. I can provide a PR if there is any interest. Cheers, |
Hey @azachar @stanleygu, I am trying to solve the same thing. I am not clear on where I'd capture the originally requested url, where I'd store it, and where to place the redirect once the user logs in. Either of you up for providing a gist? Anyone else have an example? I asked on Stack Overflow but no solution yet... http://stackoverflow.com/questions/28870430/redirect-to-original-request-after-authentication-angular-fullstack |
An option using state: Before login:
After login:
|
If someone who is not authenticated yet initially requests an authenticated route, e.g.
/settings
, how would it be possible to redirect to the original route after login?The text was updated successfully, but these errors were encountered: