Replies: 9 comments 9 replies
-
have you tried import { signOut } from "next-auth/react"
export function SignOut() {
return <button onClick={() => signOut()}>Sign Out</button>
} |
Beta Was this translation helpful? Give feedback.
-
When I call signout I get the error shown below: |
Beta Was this translation helpful? Give feedback.
-
I have found a solution - use both server-side and client logout on the action for the signout button. Signout Button on both server actions and client side
|
Beta Was this translation helpful? Give feedback.
-
maybe you forgot to add |
Beta Was this translation helpful? Give feedback.
-
I am also experiencing this issue.
To me, It looks like a bug with the I forgot to add: |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue in that useSession is not reactive and only outputs it's value once on page load. My workaround is to call getSession in a useEffect hook. i.e:
|
Beta Was this translation helpful? Give feedback.
-
Same issue still occurring -- client component session state not updating when using
One option: only use |
Beta Was this translation helpful? Give feedback.
-
I have the same issue using a custom provider too, is this going to be addressed ? |
Beta Was this translation helpful? Give feedback.
-
Still the problem occurs. The signOut is not working for both client side and server side. |
Beta Was this translation helpful? Give feedback.
-
In a client-only page, I call a server action using the signIn method. All other client components use the hook useSession are updated showing authorised options.
When call the signOut method the client components are not updated with the new state. It is only possible to see the user has logged out by refreshing the page from the browser.
I notice there is refresh flicker on login but no such flicker on logout.
`export async function signIn() {
return await auth.signIn('github');
}
export async function signOut() {
await auth.signOut();
}
Code to check status:
const session = useSession(); session.status
Versions: used:
"react": "18.2.0"
"next": "^14.2.4"
"next-auth": "^5.0.0-beta.19"
How do I get the app to recognise the user has logged out?
Beta Was this translation helpful? Give feedback.
All reactions