RefirebaseRefirebase

handleSignOut

Sign out the current user.

Usage

You can use the signOut function from useAuth or auth.handleSignOut() from useRefirebase to sign the user out.

SignOutButton.tsx
import { useAuth } from 'refirebase/react';

export function SignOutButton() {
  const { signOut } = useAuth();

  const handleSignOut = async () => {
    const { error } = await signOut();
    if (error) console.error(error);
  };

  return <button onClick={handleSignOut}>Sign Out</button>;
}

Return value

Returns

Promise<{ error?: ReturnType<typeof toRefirebaseError> }>

An object containing an error if the sign-out fails.