# useAuthContext | @account-kit/react

> A custom hook that provides the authentication context based on the specified authentication step type. It ensures that the hook is used within an `AuthModalProvider` and throws an error if the context is not available or if the current auth step type does not match the expected type.

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function useAuthContext<TType>(type?): AuthContextType<TType>;
```

Defined in: [account-kit/react/src/components/auth/context.ts:73](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/components/auth/context.ts#L73)

## Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TType` *extends*
        | `undefined`
        | `"email_verify"`
        | `"otp_verify"`
        | `"totp_verify"`
        | `"passkey_verify"`
        | `"passkey_create"`
        | `"passkey_create_success"`
        | `"email_completing"`
        | `"oauth_completing"`
        | `"initial"`
        | `"complete"`
        | `"eoa_connect"`
        | `"wallet_connect"`
        | `"pick_eoa"`
      </td>

      <td>
        | `undefined`
        | `"email_verify"`
        | `"otp_verify"`
        | `"totp_verify"`
        | `"passkey_verify"`
        | `"passkey_create"`
        | `"passkey_create_success"`
        | `"email_completing"`
        | `"oauth_completing"`
        | `"initial"`
        | `"complete"`
        | `"eoa_connect"`
        | `"wallet_connect"`
        | `"pick_eoa"`
      </td>
    </tr>

  </tbody>
</table>

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `type?`
      </td>

      <td>
        `TType`
      </td>

      <td>
        Optional type of authentication step to validate against the current context
      </td>
    </tr>

  </tbody>
</table>

## Returns

`AuthContextType`\<`TType`>

The authentication context for the current component