While the hooks manage the flow end-to-end, you are responsible for opening the portal URLs that Para generates during authentication (for verification, passkey creation, password entry, etc.). Use
para.onStatePhaseChange() to listen for these URLs and open them. Passkey URLs must be opened in a popup — WebAuthn does not work in iframes. See Handling State Changes below.Prerequisites
You must have a Para account set up with authentication methods enabled in your Developer Portal. Install the React SDK:ParaProvider as described in the React quickstart guide.
Hooks Reference
This hook must be paired with
para.onStatePhaseChange() to handle portal URLs that appear during authentication (verification, passkey, password, PIN). See Handling State Changes for the full state listener pattern.This hook must be paired with
para.onStatePhaseChange() to handle portal URLs that appear after OAuth completes (e.g. passkey or password setup for returning users). See Handling State Changes for the full state listener pattern.Handling State Changes
During authentication, Para’s state machine progresses through phases that require user interaction — either opening portal URLs (for basic login users and biometric flows) or showing a code input (for non-basic-login new signups). Since you’re building a custom UI without theParaModal, you need to subscribe to state changes and handle them yourself.
Use para.onStatePhaseChange() to receive a StateSnapshot. The snapshot contains authPhase (what stage the flow is in) and authStateInfo (URLs and flags for the current stage):
When
authPhase is 'awaiting_account_verification', the user is a non-basic-login new signup who has been sent an OTP code via email or SMS. There is no URL to open — you must show a code input field and call useVerifyNewAccount() to submit the code. If the user needs a new code, use useResendVerificationCode(). The simplified hook is waiting for this step to complete before it proceeds. See the full example below.authStateInfo Fields
| Field | Type | Description |
|---|---|---|
verificationUrl | string | null | Portal URL for basic login users to complete auth (OTP, passkey, etc.) in the hosted portal. Only set during awaiting_session_start for basic login flows. Can be opened in a popup or iframe. |
passkeyUrl | string | null | Portal URL for passkey login or creation. Must be opened in a popup — WebAuthn does not work in iframes. |
passwordUrl | string | null | Portal URL for password login or creation. Can be opened in a popup or iframe. |
pinUrl | string | null | Portal URL for PIN login or creation. Can be opened in a popup or iframe. |
isPasskeySupported | boolean | Whether the user’s device supports passkeys/WebAuthn. |
isNewUser | boolean | Whether this is a new signup flow. |
passkeyHints | BiometricLocationHint[] | null | Hints for known device detection. |
State Phase Reference
TheStateSnapshot returned by para.onStatePhaseChange() contains three phase fields that tell you exactly where in the flow the user is. Use these to drive your UI.
corePhase — Top-Level Lifecycle
| Phase | Description |
|---|---|
setting_up | Para is initializing. Show a loading indicator. |
auth_flow | The user is in the authentication flow. Refer to authPhase for details. |
wallet_flow | Authentication succeeded; wallets are being set up. Refer to walletPhase for details. |
authenticated | The user is fully logged in with wallets ready. |
guest_mode | The user is in guest mode (no full authentication). |
logging_out | A logout is in progress. |
error | An unrecoverable error occurred. Check snapshot.error. |
authPhase — Authentication Flow Detail
| Phase | Description | What to show |
|---|---|---|
unauthenticated | No auth in progress. | Login / signup form. |
authenticating_email_phone | Email/phone auth initiated, routing in progress. | Loading indicator. |
authenticating_oauth | Standard OAuth flow in progress. | Loading indicator or “Waiting for provider…”. |
authenticating_telegram | Telegram auth in progress. | Telegram popup/iframe. |
authenticating_farcaster | Farcaster auth in progress. | Farcaster QR code. |
processing_authentication | Server is processing the auth request. | Loading indicator. |
verifying_new_account | Verification code is being validated. | Loading indicator. |
awaiting_account_verification | New user (non-basic-login) needs to enter an OTP verification code sent to their email or phone. No URL to open — authStateInfo will not have a verificationUrl. | Show a code input field. Call para.verifyNewAccount({ verificationCode }) when submitted. |
awaiting_session_start | Portal URLs are ready. For basic login users, authStateInfo.verificationUrl is set (user completes auth in the portal). For passkey/password/PIN users, passkeyUrl, passwordUrl, and/or pinUrl are set. | Open the appropriate URL. Passkey URLs must use a popup on web. |
waiting_for_session | Session polling is active — waiting for the user to complete in the portal. | ”Completing setup…” loading state. |
authenticated | Auth flow is complete. (Core may still be in wallet_flow.) | Transition to authenticated UI, or show wallet loading indicator. |
guest_mode | The user is in guest mode (no full authentication). | Guest UI. |
error | Auth flow failed. Check snapshot.error. | Error message with retry option. |
Basic login vs passkey/password/PIN: Basic login users complete their entire authentication through a portal URL — the
verificationUrl handles OTP entry, passkey creation, etc. in a single hosted flow. Passkey, password, and PIN users go through a two-step process where OTP verification happens in your app (via awaiting_account_verification) and biometric setup happens in the portal (via awaiting_session_start).walletPhase — Wallet Setup Detail
| Phase | Description |
|---|---|
checking_wallet_state | Checking if wallets need to be created. |
needs_wallets | Wallets need to be created for this user. |
claiming_wallets | Claiming pregenerated wallets that were created for this user before signup. |
creating_wallets | Wallets are being created. |
waiting_for_wallets | Waiting for wallet creation or claiming to complete. |
setting_up_after_login | Performing post-login wallet setup (e.g. refreshing session, syncing wallet state). |
wallets_ready | Wallets are created and ready to use. |
no_wallets_needed | User already has wallets; nothing to create. |
error | Wallet creation failed. Check snapshot.error. |
Email / Phone Authentication
UseuseAuthenticateWithEmailOrPhone to authenticate a user by email or phone number. The hook handles the complete flow: it determines whether the user is new or returning, manages session polling, waits for session establishment, and creates wallets for new signups.
You need to handle two things alongside the hook:
- State listener — subscribe to
onStatePhaseChangeto open portal URLs (verification, passkey, password, PIN) when they become available. - OTP code input — when
authPhaseis'awaiting_account_verification', show a code input and calluseVerifyNewAccount()to submit the code. The hook is waiting for this before it proceeds.
{ phone: '+1234567890' } instead of { email }:
OAuth Authentication
UseuseAuthenticateWithOAuth to authenticate a user via a third-party OAuth provider. The hook manages the OAuth redirect/popup, polls for completion, waits for session establishment, and creates wallets for new signups.
Standard OAuth (Google, Apple, Discord, X, Facebook)
For standard OAuth providers, theonOAuthPopup callback gives you the initial popup window. The state listener handles biometric URLs that appear after the OAuth step completes (e.g. when a returning user needs to authenticate with their passkey).
Telegram
Telegram authentication works the same way — the hook manages the Telegram bot interaction automatically:Farcaster
Farcaster uses a QR code flow. Use theredirectCallbacks.onOAuthUrl callback to receive the Farcaster Connect URI and display it as a QR code:
Cancelling Authentication
Both hooks accept polling callbacks with anisCanceled function. Return true from isCanceled to stop the polling loop — for example, when the user closes a popup or navigates away. The cancellation is clean: no error is thrown, and the optional onCancel callback is fired.
logout also cancels all active polling and resets the state phases back to unauthenticated. This is useful for implementing a “Cancel” button that fully resets the auth flow:
Handling Results
Both hooks return anAuthenticateResponse object with the same shape:
| Field | Description |
|---|---|
authInfo | Contains the user’s primary authentication information such as email, phone, userId, and any auth extras. |
hasCreatedWallets | true if the user is new and wallets were auto-created during signup. false for returning users. |
recoverySecret | Present only for non-basic-login when new wallets are created. Basic login users do not receive a recovery secret. This should be displayed to the user or stored securely — it cannot be retrieved again. |