Replies: 10 comments 13 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.
-
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