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
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
authPhase — Authentication Flow Detail
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
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: