useCurrentScreen()
React hook that gets the current screen context and state.This hook provides access to client configuration, organization details, screen identification,
tenant settings, transaction state, and authorization parameters for building custom authentication UI.
Return Value
ReturnsCurrentScreenOptions object with the following properties, or null if unavailable:client- Application identifier and metadataorganization- Organization ID and metadata (for Auth0 Organizations)prompt- Current prompt name (e.g., “login”, “consent”, “mfa”)screen- Current screen name (e.g., “login-id”, “login-password”, “mfa-otp-challenge”)tenant- Tenant configuration including enabled localestransaction- Transaction state, errors array, and current localeuntrustedData- Authorization parameters from the client (validate before use)
Key Points
- Use
screen.namefor conditional rendering of authentication screens - Always use optional chaining (
?.) as nested properties can benull - Check
transaction.errorsfor displaying validation errors - Access
organization.metadatafor organization-specific branding
Returns
CurrentScreenOptions | nullCurrent screen context data, or null if not availableBasic screen routing
Accessing multiple properties