> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Hooks

React hooks for authentication, wallet management, and UI control.

:::note
Try the hooks in our [Openfort playground](https://playground.openfort.io/).
:::

## Authentication

| Hook | Description |
|------|-------------|
| [`useUser`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useUser) | Current user, auth flags, and access token |
| [`useEmailAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useEmailAuth) | Email/password authentication |
| [`useEmailOtpAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useEmailOtpAuth) | Email OTP (passwordless) authentication |
| [`usePhoneOtpAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/usePhoneOtpAuth) | Phone OTP (SMS) authentication |
| [`useOAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useOAuth) | OAuth provider authentication |
| [`useGuestAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useGuestAuth) | Guest authentication |
| [`useConnectWithSiwe`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useConnectWithSiwe) | SIWE wallet authentication (from `@openfort/react/wagmi`) |
| [`useAuthCallback`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useAuthCallback) | OAuth and email verification callbacks |
| [`useSignOut`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useSignOut) | Sign out and clear session |
| [`useWalletAuth`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useWalletAuth) | Connect and link external wallets with SIWE (from `@openfort/react/wagmi`) |

## Wallets

| Hook | Chain | Description |
|------|-------|-------------|
| [`useEthereumEmbeddedWallet`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useEthereumEmbeddedWallet) | Ethereum | Address, chainId, provider, isConnected, plus create, setActive, export key. Accepts optional `options` with `chainId` and `recoveryParams`. |
| [`useSolanaEmbeddedWallet`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useSolanaEmbeddedWallet) | Solana | Embedded wallet: create, list, setActive, export key, cluster, rpcUrl. Accepts optional `options` with `cluster` (counterpart of Ethereum `chainId`) and `recoveryParams`. |

## Assets

| Hook | Description |
|------|-------------|
| [`useEthereumWalletAssets`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useEthereumWalletAssets) | Multi-token asset inventory for Ethereum (from `@openfort/react/ethereum`) |
| [`useSolanaWalletAssets`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useSolanaWalletAssets) | Native SOL and SPL token inventory (from `@openfort/react/solana`) |

## Permissions (Ethereum only)

| Hook | Description |
|------|-------------|
| [`useGrantPermissions`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useGrantPermissions) | Grant session key permissions (EIP-7715) |
| [`useRevokePermissions`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useRevokePermissions) | Revoke session key permissions |
| [`use7702Authorization`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/use7702Authorization) | Sign EIP-7702 authorizations |

## UI

| Hook | Description |
|------|-------------|
| [`useUI`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useUI) | Modal control: open, close, openProfile |

## Core

| Hook | Description |
|------|-------------|
| [`useOpenfort`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useOpenfort) | Universal. Core SDK client: user, embeddedState, client, logout, updateUser, etc. |

## Utility

These hooks are exported from `@openfort/react/wagmi` (Ethereum/Wagmi only).

| Hook | Description |
|------|-------------|
| `useChains` | Access configured blockchain chains |
| `useChainIsSupported` | Check if a chain ID is supported |

### useChains

Access all blockchain chains configured in the Wagmi config.

```tsx
import { useChains } from '@openfort/react/wagmi'

function ChainSelector() {
  const chains = useChains()

  return (
    <select>
      {chains.map((chain) => (
        <option key={chain.id} value={chain.id}>
          {chain.name}
        </option>
      ))}
    </select>
  )
}
```

### useChainIsSupported

Check if a specific chain ID is supported in the current configuration.

```tsx
import { useChainIsSupported } from '@openfort/react/wagmi'

function ChainStatus({ chainId }: { chainId?: number }) {
  const isSupported = useChainIsSupported(chainId)

  return <span>{isSupported ? 'Supported' : 'Unsupported'}</span>
}
```

## Types

| Type | Description |
|------|-------------|
| `CreateEmbeddedWalletOptions` | Options for `create()` on both `useEthereumEmbeddedWallet` and `useSolanaEmbeddedWallet`. See [Create wallet](https://www.openfort.io/docs/products/embedded-wallet/react/wallet/create). |
| `CreateEmbeddedWalletResult` | Resolved action result: `{ account: EmbeddedAccount } \| { error: OpenfortError }`. |
| `OpenfortHookOptions<T>` | Generic options for hooks: `onSuccess` and `onError`. See [Error handling](https://www.openfort.io/docs/products/embedded-wallet/react/errors#openforthookoptions). |
| `SetRecoveryOptions` | Shared options for `setRecovery()` on both embedded wallet hooks: `previousRecovery`, `newRecovery`. |

## Constants

| Export | Description |
|--------|-------------|
| `embeddedWalletId` | Identifier for the Openfort embedded wallet ('xyz.openfort') |
| `OPENFORT_VERSION` | Current SDK version string |

:::note
Imports are tree-shaken by entry point: `@openfort/react`, `@openfort/react/ethereum`, `@openfort/react/solana`, `@openfort/react/wagmi`. Only import from the subpath you need.
:::
