React Hooks
Authentication hooks from @emblemvault/emblem-auth-react for accessing auth state and actions.
📖 Related Documentation
useEmblemAuth Hook
Access authentication state and actions. Returns all wallet info, session data, and methods to control authentication flow.
🔌 Provider Required
This hook must be used within EmblemAuthProvider. If used outside the provider, it will throw an error.
Basic Usage
TS
MyComponent.tsxLoading...
Return Values
| Property | Type | Description |
|---|---|---|
| session | AuthSession | null | Current auth session with user data & tokens |
| isAuthenticated | boolean | Whether user is authenticated |
| isLoading | boolean | Loading state during initialization/auth |
| error | Error | null | Authentication error if any |
| vaultInfo | VaultInfo | null | Vault details (addresses, metadata) |
| vaultId | string | null | User's vault ID |
| walletAddress | string | null | Primary wallet address (EVM or Solana) |
| visitorId | string | null | Anonymous visitor tracking ID |
| openAuthModal | () => Promise<void> | Open authentication modal |
| logout | () => void | Logout and clear session |
| refreshSession | () => Promise<AuthSession | null> | Refresh auth token |
| authSDK | EmblemAuthSDK | null | Direct access to underlying SDK |
Session Refresh
TS
TokenRefresher.tsxLoading...
Direct SDK Access
For advanced use cases, access the underlying EmblemAuthSDK instance directly:
TS
AdvancedComponent.tsxLoading...
AuthSession Type
user: AuthUser
authToken: string
refreshToken?: string
expiresAt: number
appId: string
scope?: string
VaultInfo Type
vaultId: string
evmAddress?: string
solanaAddress?: string
hederaAccountId?: string
createdAt?: string
metadata?: Record