# `useGuestAuth`

Create guest accounts for instant onboarding without requiring authentication.

## Usage

```tsx
import { useGuestAuth } from '@openfort/react';

function GuestEntry() {
  const { signUpGuest, isLoading } = useGuestAuth();

  const handleClick = async () => {
    const { user } = await signUpGuest();
    if (user) console.log('Guest created:', user.id);
  };

  return <button onClick={handleClick} disabled={isLoading}>Continue as guest</button>;
}
```

## Return type

```ts
type GuestAuthReturn = {
  signUpGuest(options?: GuestOptions): Promise<GuestResult>
  isLoading: boolean
  isError: boolean
  isSuccess: boolean
  error?: OpenfortError | null
}

type GuestResult = {
  user?: User
  wallet?: UserWallet
  error?: OpenfortError
}
```

## Hook options

Configure default behavior when initializing the hook.

```ts
type UseGuestHookOptions = {
  // Log out the user if wallet recovery fails. Defaults to true.
  logoutOnError?: boolean
  // Automatically recover the wallet after authentication. Defaults to true.
  recoverWalletAutomatically?: boolean
  onSuccess?: (data: GuestResult) => void
  onError?: (error: OpenfortError) => void
  throwOnError?: boolean
}
```

## Parameters

### signUpGuest

```ts
type GuestOptions = {
  // Overrides the hook-level default.
  logoutOnError?: boolean
  // Overrides the hook-level default.
  recoverWalletAutomatically?: boolean
  onSuccess?: (data: GuestResult) => void
  onError?: (error: OpenfortError) => void
}
```
