-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
How to properly redirect to a custom page after successful signIn #7645
Comments
@joaocasarin In your
|
https://next-auth.js.org/getting-started/client#specifying-a-callbackurl Eg.: |
Hi, from what I understand from docs, when i put undefined as first arg, second callback url like Also why const handleLogOut = () => signOut({ callbackUrl: '/' }) doest not redirect ofter signOut to '/'? Should right? Thanks! Update: my mistake, add to signOut callbackUrl i had this in [...nextauth].js: |
And that callback URL must be whitelisted one right? @balazsorban44 |
If you are talking about whitelisting the callback URL on the provider, you don't have to. I just tested it with the Google provider. I only had to whitelist the base url. |
Is there a way to make the callBackUrl dynamic? I want the users to go back the previous page from where they were redirected to login page and they can be from different pages. |
You can try |
You can cache data as query strings in the url. You can use this to remember what initiated the login request. You can also use localStorage for the caching. |
thank you!! this is not documented |
Consider this option
|
Question 💬
Current behavior: user just go back to home.
Expected behavior: when the user successfully sign in using one of the NextAuth providers (in this case, Spotify), I need them to be redirected straight to a specific page called
/dashboard
, which is protected by:My
NextAuth
is configured as follow:How to reproduce ☕️
Clone this repo
Setup your
.env
file properly according to your Spotify API applicationrun
yarn dev
Click the button
Sign In with Spotify
You will see that you are still being redirected to where you were, not the page I want.
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered: