Skip to content

useAuthContext

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.

Import

import { useAuthContext } from "@account-kit/react";

Usage

import { useAuthContext } from "@account-kit/react";
 
const { authStep } = useAuthContext();

Parameters

type

AuthStep["type"] Optional type of authentication step to validate against the current context

Returns

AuthContextType The authentication context for the current component