Client Side

signOut

The signOut function provides a programmatic way to terminate a user session securely and clear all local authentication state.

Usage

Import the function and call it within an event handler or a standard function:

terminal
import { signOut } from "@ezz-auth/next";

export default function LogoutButton() {
  const handleLogout = async () => {
    await signOut();
    // Optional: Redirect user after logout
    window.location.href = "/";
  };

  return (
    <button onClick={handleLogout}>
      Sign Out
    </button>
  );
}

Security & Cleanup

Server-Side Invalidation

The session is immediately revoked in the Core Auth System, making the token useless for future requests.

Secure Cookie Clearing

HTTP-only cookies are cleared from the browser, preventing any local remnants of the session.

State Reset

The AuthProvider context is instantly cleared, updating the UI across all open tabs.