Skip to main content
Para provides simplified React hooks that handle the entire authentication flow in a single call. Instead of managing multiple steps (signup/login, verification, session polling, wallet creation) separately, these hooks orchestrate everything automatically and return a unified response. Available in v2.13.0+
These hooks are long-running — they internally poll for session completion and wait for the user to finish interacting with the portal. Place the hook call in a provider or higher-order component that will not unmount during the authentication flow. If the component unmounts while the hook is running, the authentication will be interrupted.
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:
Ensure your app is wrapped with the 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 the ParaModal, you need to subscribe to state changes and handle them yourself.
Passkey URLs must be opened in a popup window, not an iframe. WebAuthn/passkey operations require a top-level browsing context and will fail silently in iframes due to browser security restrictions. Password and PIN URLs can be opened in either a popup or an iframe. Verification URLs can also use either approach.
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

The StateSnapshot 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

Use useAuthenticateWithEmailOrPhone 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:
  1. State listener — subscribe to onStatePhaseChange to open portal URLs (verification, passkey, password, PIN) when they become available.
  2. OTP code input — when authPhase is 'awaiting_account_verification', show a code input and call useVerifyNewAccount() to submit the code. The hook is waiting for this before it proceeds.
For phone number authentication, pass { phone: '+1234567890' } instead of { email }:

OAuth Authentication

Use useAuthenticateWithOAuth 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, the onOAuthPopup 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 the redirectCallbacks.onOAuthUrl callback to receive the Farcaster Connect URI and display it as a QR code:

Cancelling Authentication

Both hooks accept polling callbacks with an isCanceled 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.
For OAuth, you can cancel both the OAuth polling and session polling independently:
Calling 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 an AuthenticateResponse object with the same shape:

Next Steps