Skip to main content

Overview

authenticateWithEmailOrPhone signs a user up or in with their email or phone number and returns once they have an active session and wallets. Your app supplies the identifier and a way to collect a verification code. Para runs every other step. This guide covers:
  • The recommended single-call flow with authenticateWithEmailOrPhone
  • A SwiftUI verification-code sheet driven by the SDK
  • The manual, stage-based flow for apps that need to control each step
Beta Testing Credentials In the BETA Environment, you can use any email ending in @test.getpara.com (like dev@test.getpara.com) or US phone numbers (+1) in the format (area code)-555-xxxx (like (425)-555-1234). Any OTP code will work for verification with these test credentials. These credentials are for beta testing only. You can delete test users anytime in the beta developer console to free up user slots.

Prerequisites

To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration.
Don’t have an API key yet? Request access to the to create API keys, manage billing, teams, and more.
Need to install the SDK? Start with the . Email and phone login relies on the Associated Domains (passkeys) and URL scheme (appScheme) you configure there. Call authenticateWithEmailOrPhone(auth:authorizationController:webAuthenticationSession:verificationCodeProvider:) with the user’s email or phone. It works for both new and returning users and returns an AuthenticationResult:

What the user sees

Para decides which sign-in experience runs for your app. You don’t configure or detect it, so build for both:
  • Para’s updated authentication flow. The user verifies their email or phone on a Para-hosted page shown in the WebAuthenticationSession sheet. verificationCodeProvider isn’t called on this flow.
    • New users then create their first credential. When your app offers passkeys and the device can create one, iOS shows the native passkey prompt. Otherwise the user sets a password, or a PIN when your app offers only PINs, on a Para-hosted page. A device can’t create a passkey without a device passcode; if your app offers no password or PIN, the SDK still tries the native passkey prompt.
    • Returning users also verify the code on the Para-hosted page first: every email or phone sign-in starts with the code. If the wallet is protected by a passkey on the device, the page then hands the account back to your app for the native passkey prompt; that passkey must belong to the account the user verified. Otherwise they unlock on a Para-hosted page, for example with their password.
  • The earlier flow (fallback). If the updated flow isn’t enabled for your app, every email or phone sign-in still goes through the Para-hosted code page: sign-in doesn’t say whether an account exists until the code is entered, so verificationCodeProvider isn’t called. A returning user whose account is protected by a native passkey gets an error asking them to sign in again; signing in again then shows the native passkey prompt. On this fallback, isNewUser isn’t reliable. Keep verificationCodeProvider in place: the SDK still requires it. None of this applies on the updated flow.
In both cases Para creates the user’s wallets before the call returns.
A WebAuthenticationSession is required for the Para-hosted pages. Register one with setDefaultWebAuthenticationSession(_:) as shown below, or pass webAuthenticationSession: to the call. Without one, the call throws instead of showing the hosted page.

Example: SwiftUI with a verification-code sheet

The verificationCodeProvider closure is async, so it can wait for the user. This example suspends on a CheckedContinuation while a sheet collects the code. Submitting the sheet resumes the continuation with the code. Dismissing it throws, which cancels sign-in.
AuthenticationView.swift
Resume the continuation exactly once. The submitCode() and cancelCodeEntry() helpers clear codeContinuation after resuming, so a later sheet dismissal doesn’t resume it a second time.

Handle errors

authenticateWithEmailOrPhone throws when sign-in can’t finish. Common cases:
  • A user is already signed in. The call throws ParaError.error("A user is already signed in. Call logout() before signing in again.") instead of starting a new sign-in. Call logout() first.
  • The user cancels. Closing a Para-hosted sheet, including the credential setup page, throws ParaError.error("Authentication cancelled") and cancels sign-in. Canceling the passkey prompt throws too, and so does any error thrown from your verificationCodeProvider.
  • The wrong passkey. When the Para-hosted page hands sign-in back to your app for the native passkey prompt and the user picks a passkey that belongs to a different account, the call throws ParaError.error("That passkey belongs to a different account. Choose the passkey for this account.") and that sign-in is discarded. If the page hands back without naming the account, the call throws ParaError.error("The sign-in page did not say which account to sign in to.").
  • Too many incorrect codes. After Para’s retry limit, the call throws the last verification error.
  • No WebAuthenticationSession. The call throws when a Para-hosted page is needed and no session is available.
  • Two-factor authentication is required. On Para’s updated authentication flow the user completes login 2FA on the Para-hosted page. When the updated flow isn’t running for your app, the call uses the code-entry flow and throws ParaTwoFactorRequiredError for an account that must complete login 2FA. See .
After a failure the SDK resets the in-progress sign-in, so you can call authenticateWithEmailOrPhone again right away.

Manual Stage-Based Flow

Use the stage-based methods when you need to control each step yourself, such as choosing between passkey and password signup in your own UI. These methods remain available and always run the code-entry flow described above. They don’t use Para’s updated authentication flow and can’t host login 2FA: initiateAuthFlow and handleVerificationCode cancel the sign-in and throw ParaTwoFactorRequiredError when the account must complete it. New integrations should prefer authenticateWithEmailOrPhone. Which steps your users see depends on the sign-in and security settings you choose for your app in the . With the default settings, Para hosts the whole flow. The optional sections below cover the passkey and password steps, which you only need if your app’s settings require them.

Start the Authentication Flow

Inject the Para manager and authentication helpers, then launch the flow with whichever identifier your UI collects (email or phone). Para One Click handles the rest unless you enable extra verification.
AuthenticationView.swift
The completeLogin() helper can mark your app as authenticated and transition to the signed-in experience:
AuthenticationView.swift

Handle OTP Signup (Optional)

Only implement this step if you turn on OTP / passkey signup in the Developer Portal. Collect the OTP, exchange it for a verified state, and finish signup. handleSignup also creates the new user’s wallets:
AuthenticationView.swift
If you skip setDefaultWebAuthenticationSession(_:), initiateAuthFlow returns a loginUrl you can present manually using presentAuthUrl(_:context:webAuthenticationSession:). The automatic .done stage shown above relies on the default session being set.

Support Direct Passkey Login

If you already know a user has passkeys registered, you can offer a shortcut that skips email/phone input:
AuthenticationView.swift

Next Steps

  • Add social providers alongside this flow in
  • Ask users for a second factor at sign-in with
  • Manage existing sessions with
  • See every authentication method in the