Sign Out
Call signOut() from next-auth/react. In v4, callbackUrl sets the destination. If your backend also maintains its own session or refresh token, revoke it through a deliberate backend logout flow too.
Sign-out button
import { signOut } from "next-auth/react";
export default function SignOutButton() {
return <button onClick={() => signOut({ callbackUrl: "/" })}>Sign out</button>;
}💡 Do not implement logout by only hiding UI or manually deleting arbitrary cookies.