How would I programmatically sign out a user in Next-Auth on the server side?
Inside /api/auth/[...nextauth].js there is a jwt function:
const callbacks = {
async jwt ({ token, user }) {
// How to sign out a user?
signOut(); <--- can't use this on the server side
}
}
Unfortunately, the signOut() function is only for the client side. It produces an error if used here.
I have read the very bare-bones Next Auth REST API page and I can't get a POST call to "/api/auth/signout" to work. If that is the correct method can someone show me some working code? Does it need any kind of authorization token?
https://next-auth.js.org/getting-started/rest-api
Thanks!