Replies: 13 comments 14 replies
-
set redirect property to true
|
Beta Was this translation helpful? Give feedback.
-
@marksmall, any luck resolving this? |
Beta Was this translation helpful? Give feedback.
-
I encountered the same issue using
where What worked for me was replacing it with the following, which, looks exactly like what you had..I didn't need
|
Beta Was this translation helpful? Give feedback.
-
I should have posted back here ages ago, sorry for not doing so. What i ended up doing was : <button onClick={() => {
signOut();
router.push('/');
}>
Sign Out
</button> |
Beta Was this translation helpful? Give feedback.
-
I'm not saying my way is the best/correct/recommended way, but it worked, so was good enough for me. |
Beta Was this translation helpful? Give feedback.
-
route.push worked for me too. But, how do we do it properly? |
Beta Was this translation helpful? Give feedback.
-
If it still a case. This works for me: Usage: |
Beta Was this translation helpful? Give feedback.
-
For NextAuth, v5-beta |
Beta Was this translation helpful? Give feedback.
-
Add redirect function in callbacks of NextConfig. This will be same for sign-in and signout. In this case it is redirecting towards home page. redirect: async ()=>{ |
Beta Was this translation helpful? Give feedback.
-
In my case(next-auth v4.24) the /api/auth related route I'm using localhost:3000, page public url is under domain localhost:3001. If you only use
Then in your signOut you may want to do sth like this:
|
Beta Was this translation helpful? Give feedback.
-
has this issue been resolved yet. I am using server action to signout And I still get redirect to signin and the url is replaced |
Beta Was this translation helpful? Give feedback.
-
i had the same problem and i forgot to add to env vars |
Beta Was this translation helpful? Give feedback.
-
Next auth does not work withought the url so... since the redirect issue is
persistent after successfull logins or logouts how can suggesting adding
the env variable be a solution?
Georgios Pamfilis
Occupation: Software Developer, Environmental Engineer.
Company: pamfili.co
*Personal Website:* https://pamfilis.dev
*Business Website:* https://pamfili.co
*Connect with me on LinkedIn: linkedin.com/in/george-pamfilis/
<https://www.linkedin.com/in/yourprofile>*
------------------------------
…On Mon, Jul 28, 2025, 15:28 Ayush Badola ***@***.***> wrote:
i had the same problem and i forgot to add to env vars NEXTAUTH_URL.
after adding it, the problem was solved
Guys this guy already mentioned the solution , it was the missing env
variable all along. Make sure to include NEXTAUTH_URL , and the url must be
the deployed app url.
—
Reply to this email directly, view it on GitHub
<#8686 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACHH3QWZEFBVNF77TLTGTCD3KYJOTAVCNFSM6AAAAAA5DLRECKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGOJQHE4DQNI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When I click the button that calls the
signOut
function, I am always redirected toapi/auth/signin
. What I want is to be redirected to some public page instead.Code used to signOut and redirect:
The URL I am always sent to is http://localhost:3000/api/auth/signin?callbackUrl=%2F.
Why am I redirected to the signin page and is there anything I can do to prevent that?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions