-
-
Notifications
You must be signed in to change notification settings - Fork 188
enh(#861): Redirect back to requested page after authentication #870
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
enh(#861): Redirect back to requested page after authentication #870
Conversation
|
Really looking forward to this feature |
d84b51f to
f3ccf91
Compare
commit: |
β¦r-authentication
zoey-kaiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this feature! Thank you so much for your PR β€οΈ
One suggestion I would have is to respect the addDefaultCallbackUrl option inside the middleware and only add the callback URL to the redirect if it is enabled!
This should be a pretty straight forward adjustments, where you check if globalAppMiddleware.addDefaultCallbackUrl is set before adding query.redirect to the navigateTo call!
zoey-kaiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally approved π₯³
@phoenix-ru, please do a code review π
phoenix-ru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andychukse Thanks for your PR! I think it will bring local provider in parity with what authjs already does in terms of redirects
|
PR Released in https://github.com/sidebase/nuxt-auth/releases/tag/0.9.3 π₯³ |
π Linked issue
#861
β Type of change
π Description
Add functionality redirect user back to requested page after authentication
Added a redirect query parameter to auth middleware navigateTo when a guest visits authenicated page.
This will help users redirect back to previous page after sign in.
Currently when guest tries to access a protected page they are redirected to
/loginpage and after login they are redirect to defaultcallbackUrlunless they specifycallbackUrlin thesignInfunction.This feature will help automatically redirect a user back to the page they requested after login. For example, if they requested to access
'/profile'and they are redirected to login page, after successful login, they will be redirected back to'/profile'. They can also override this by providing acallbackUrlin the signIn function as it is currentlyπ Checklist