Skip to main content
This guide covers building custom authentication UI using the @getpara/web-sdk client directly — no React required. This approach works with any JavaScript framework (Vue, Svelte, Angular, etc.) or plain vanilla JS. Available in v2.13.0+
The simplified methods (authenticateWithEmailOrPhone, authenticateWithOAuth) are long-running — they internally poll for session completion and wait for the user to finish interacting with the portal. Ensure the calling context will not be destroyed while the method is running (e.g. avoid calling from a component that may unmount mid-flow).
While these methods 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

Install the Web SDK:

Client Setup

Create a Para client instance:

Method Reference

This method 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 the guide for your platform 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 method, 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 the guide for your platform 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 on authStateInfo. You need to subscribe to state changes and open these pages 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):
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 verifyNewAccount. 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 method 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 a target="_blank" link or noopener.
  • If your app sends a Cross-Origin-Opener-Policy header, use same-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, or pinUrl after the code step, so keep listening until authentication completes.

authStateInfo Fields

State Phase Reference

The StateSnapshot returned by para.onStatePhaseChange() contains three phase fields that tell you where in the flow the user is. Use these to drive your UI.
The listener also fires when authStateInfo changes without a phase change. For example, the credential-creation URLs appear while authPhase stays waiting_for_session. Decide what to show from the authStateInfo URLs and flags, and use the phase for loading and error states.

corePhase — Top-Level Lifecycle

authPhase — Authentication Flow Detail

These phases run on Para’s updated authentication flow, for every sign-in method:
React Native apps that haven’t set supportsAuthV2 run the earlier flow. Its phases replace authenticating_v2 and processing_authentication_v2:
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

Use para.authenticateWithEmailOrPhone() to authenticate a user by email or phone. The method handles the complete flow: determining whether the user is new or returning, session polling, and wallet creation. Combine it with the state listener above, which opens the hosted code page and any passkey, password, or PIN page.
For phone number authentication, pass { phone: '+1234567890' } instead of { email }:

OAuth Authentication

Use para.authenticateWithOAuth() to authenticate a user via a third-party OAuth provider. The method 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, call the method 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 — pass "TELEGRAM" as the method:

Farcaster

Farcaster works the same way. Pass "FARCASTER" as the method. 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 authenticateWithOAuth, 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 para.authenticateWithCustomOAuth(). 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.
It returns the same AuthenticateResponse as the other methods.

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 in your app to sign the sign-in message, and the Para Modal provides those connectors. Calling loginExternalWallet from @getpara/web-sdk on its own doesn’t answer that request, 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 call resolves as usual once the user decides.

Cancelling Authentication

Both methods accept polling callbacks with an isCanceled 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.
To cancel when the user closes the popup, treat a closed popup as a cancel only if authStateInfo.userId is still null, and give the SDK one more check before deciding:
Pass it as sessionPollingCallbacks.isCanceled: createPopupCancelCheck(). 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:
For a “Cancel” button, call para.cancelAuthFlow(). It stops the flow and returns authPhase to unauthenticated:
Calling para.logout() also cancels all active polling and resets the state phases back to unauthenticated, and clears the session:

Handling Results

Both methods return an AuthenticateResponse object with the same shape:

Framework Examples

Vue 3 (Composition API)

Svelte

Next Steps