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 open the Para-hosted pages that appear during authentication: the code page (verificationUrl), a returning user’s passkey page, and, for a new account, the passkey, password, or PIN creation pages. See Handling State Changes for the full state listener pattern.On Para’s updated authentication flow, the sign-in runs on a Para-hosted page published as
authStateInfo.oauthUrl (Telegram and Farcaster included). On the web, open a blank popup in the click handler before calling this hook, then point it at oauthUrl from your para.onStatePhaseChange() listener. The same listener opens the passkey, password, or PIN creation page if a new account has to set one up. See OAuth Authentication for the full pattern.Handling State Changes
During authentication, Para’s state machine progresses through phases that require user interaction. Each step that collects a code or a credential runs on a Para-hosted page, and Para publishes the page URL onauthStateInfo. Since you’re building a custom UI without the ParaModal, you need to subscribe to state changes and open these pages 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):
From web SDK 3.26.0, email and phone sign-in collects the code on the Para-hosted page at
verificationUrl. The page also resends the code on request, so you don’t build a code input or call useVerifyNewAccount(). If the account must create its first passkey, password, or PIN, isCredentialSetup is true and the creation URLs appear after the code step, often without a phase change. The simplified hook keeps waiting until the user finishes.Keep the portal window connected to your app. The portal can only close its window when it finishes if it can reach the window that opened it.
- Open portal URLs with
window.open(url, name, "popup,...")as shown above, not atarget="_blank"link ornoopener. - If your app sends a
Cross-Origin-Opener-Policyheader, usesame-origin-allow-popups. - Don’t close the window based on
authPhase. The portal is still sending key shares and may ask the user to pick a wallet or approve permissions after the session is active. Leave it open until the portal or the user closes it. - New users may get a
passkeyUrl,passwordUrl, orpinUrlafter the code step, so keep listening until authentication completes.
authStateInfo Fields
State Phase Reference
TheStateSnapshot returned by para.onStatePhaseChange() contains three phase fields that tell you where in the flow the user is. Use these to drive your UI.
corePhase — Top-Level Lifecycle
authPhase — Authentication Flow Detail
These phases run on Para’s updated authentication flow, for every sign-in method:
Earlier flow phases (React Native apps without supportsAuthV2)
Earlier flow phases (React Native apps without supportsAuthV2)
React Native apps that haven’t set
supportsAuthV2 run the earlier flow. Its phases replace authenticating_v2 and processing_authentication_v2:External wallet phases
External wallet phases
loginExternalWallet with a single wallet signs in through authenticating_v2 and awaiting_session_start, like the other methods, with authStateInfo.externalWalletUrl set. Connection-only wallets (and connectExternalWallet) skip the Para-hosted page and use these phases:Para-hosted pages: On Para’s updated authentication flow, every step that collects a code, credential, or signature runs on a Para-hosted page. Your UI opens the URL from
authStateInfo and waits; the sign-in call resolves when the user finishes. Every email or phone sign-in starts with the code, for new and returning users alike, and a returning passkey, password, or PIN user proves that credential after the code. If the user also has to set up their first passkey, password, or PIN, isCredentialSetup turns true and the matching creation URLs appear.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.
Alongside the hook, use the state listener from the section above. It subscribes to onStatePhaseChange and opens the Para-hosted pages (code, passkey, password, PIN) when they become available. The user enters the email or SMS code on the hosted code page, so your UI doesn’t need a code input.
{ 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.
Bringing your own Custom OIDC provider? It works like a standard OAuth provider here — pass
"CUSTOM_OIDC" as the method once it’s configured.Standard OAuth (Google, Apple, Discord, X, Facebook)
For standard OAuth providers, callauthenticateWithOAuthAsync from your button’s click handler. With onOAuthPopup, the SDK opens the popup on the click, passes it to your callback, and then sends it to Para’s hosted sign-in page. The state listener opens the passkey, password, or PIN creation page if the account must create one after the OAuth step.
Telegram
Telegram authentication works the same way — the hook manages the Telegram bot interaction automatically:Farcaster
Farcaster works the same way. The Para-hosted page in the popup runs the Farcaster sign-in, so you don’t render a QR code yourself:Custom OAuth and OIDC Connections
Your default Custom OIDC provider signs in like any other provider: pass"CUSTOM_OIDC" as the method to useAuthenticateWithOAuth, as in the example above. For a custom provider connection you added with its own handle (an OAuth 2.0 provider or an additional OIDC provider), sign users in with useAuthenticateWithCustomOAuth. Pass "CUSTOM_OIDC" for an OIDC connection or "CUSTOM_OAUTH" for an OAuth 2.0 connection, plus the connection’s handle. Call it directly from the click handler with onOAuthPopup: the SDK opens the popup immediately and navigates it to the hosted page itself.
AuthenticateResponse as the other hooks.
External Wallets
On this flow, signing in with an external wallet also goes through a Para-hosted page (authStateInfo.externalWalletUrl). That page asks the Para SDK’s wallet connectors to sign the sign-in message, and the Para Modal is what answers it. Calling useLoginExternalWallet from your own UI doesn’t, so use the Para Modal for external wallet sign-in.
Account Linking
If the email, phone, or social account the user signs in with matches an existing Para account, the hosted page may ask whether to link them. While it does,authStateInfo.isLinking is true. The hosted page handles the choice; keep it open and, if you like, show “Linking your account” in your UI. The sign-in hook resolves as usual once the user decides.
Cancelling Authentication
Both hooks accept polling callbacks with anisCanceled function. Return true from isCanceled to stop the polling loop, for example when the user clicks a cancel button or navigates away. The SDK fires the optional onCancel callback, and the pending call rejects with a Session waiting canceled error.
The Para-hosted page can close its own window after a step, so a closed popup doesn’t always mean that the user gave up. For example, the user may still need to create a passkey, password, or PIN.
authStateInfo.userId is still null, and give the SDK one more check before deciding:
sessionPollingCallbacks.isCanceled: createPopupCancelCheck(para, popupRef).
For OAuth, pass the same sessionPollingCallbacks. The OAuth step runs on the Para-hosted page, so the SDK doesn’t use oAuthPollingCallbacks on the web:
para.cancelAuthFlow() on the client from useClient(). It stops the flow and returns authPhase to unauthenticated:
logout also cancels all active polling and resets the state phases back to unauthenticated, and clears the session:
Handling Results
Both hooks return anAuthenticateResponse object with the same shape: