authenticateWithOAuth() to handle the entire OAuth flow in a single call — it manages the redirect, polls for completion, and creates wallets for new users. If your app opts in to Para’s updated authentication flow, see Updated Authentication Flow for the passkey steps your app handles.
Have your own OpenID Connect provider? Once you set up Custom OIDC, pass
"CUSTOM_OIDC" as the method here — it works like any other provider.A provider added as a named connection with a handle (your own OAuth 2.0 provider, or an additional OIDC provider) signs in with para.authenticateWithCustomOAuth() instead. Pass provider ("CUSTOM_OIDC" or "CUSTOM_OAUTH") and the connection’s providerConfigHandle, along with the same appScheme and redirectCallbacks.onOAuthUrl you pass to authenticateWithOAuth. It returns the same result.Prerequisites
Before implementing OAuth authentication, ensure you have completed the basic Para setup for your React Native or Expo application.Standard OAuth
Usepara.authenticateWithOAuth() to authenticate a user via a third-party OAuth provider. The method manages the OAuth redirect, polls for completion, waits for session establishment, and creates wallets for new signups.
For standard OAuth providers, use the onOAuthUrl callback to open the OAuth URL in an in-app browser.
- React Native
- Expo
Updated Authentication Flow
We recommend opting in to Para’s updated authentication flow with thesupportsAuthV2 option; it becomes the default in the next major version. Once your app opts in (see Email & Phone Login), keep calling authenticateWithOAuth exactly as shown above. Para decides which sign-in experience runs for your app, so build for both:
- Para’s updated authentication flow. The URL passed to
onOAuthUrlis a Para-hosted page that runs the provider sign-in.redirectCallbacks.onOAuthUrlis required, and passappSchemeso the page returns to your app when it’s done. While the call is pending:- A new user creates their first credential once
authStateInfo.isCredentialSetupistrue. On a passkey app, callregisterPasskey(authStateInfo.passkeyId)whenpasskeyIdis set. Otherwise openauthStateInfo.passwordUrlorauthStateInfo.pinUrlin your in-app browser, with yournativeCallbackUrlappended, so the user sets a password or PIN on a Para-hosted page. - A returning user whose account is protected by a passkey is returned to your app and
onPasskeyLoginRequiredfires. Close the in-app browser if it’s still open and callloginWithPasskey(). That passkey must belong to the account the provider signed in, or the call fails. - A returning password or PIN user unlocks on the Para-hosted page.
- A new user creates their first credential once
- Without the opt-in. The provider sign-in and passkey steps work as described in the rest of this guide.
openAuthUrl helper from Email & Phone Login, which appends your nativeCallbackUrl.
useOAuthCredentialSteps.ts
On Para’s updated authentication flow, calling
authenticateWithOAuth without redirectCallbacks.onOAuthUrl throws, because your app has to open the Para-hosted page.Telegram & Farcaster
Telegram and Farcaster authentication require a different approach than standard OAuth. These providers authenticate through Para’s hosted portal, which needs to send events back to the SDK when authentication completes. On mobile, this requires opening the portal in a WebView (not an in-app browser) so the portal can communicate viawindow.ReactNativeWebView.postMessage().
You must forward messages from the WebView to the SDK using para.handleWebViewMessage().
On the updated authentication flow, Telegram and Farcaster sign-ins finish when Para confirms the session, so the pending
authenticateWithOAuth call resolves without the WebView events. The WebView setup below works on both flows, so keep it.Install
react-native-webview if you haven’t already:Method Reference
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.Cancelling Authentication
When the user closes the in-app browser without finishing, callpara.cancelAuthFlow(). It returns the auth flow to unauthenticated, and the pending authenticateWithOAuth call rejects. Both openAuth and openAuthSessionAsync resolve with a result whose type tells you how the browser closed:
sessionPollingCallbacks.isCanceled. Return true from it to stop the session polling loop, and the optional onCancel callback fires:
Without the opt-in,
oAuthPollingCallbacks accepts the same callbacks for the provider sign-in step. Para’s updated authentication flow doesn’t read oAuthPollingCallbacks, so use cancelAuthFlow() or sessionPollingCallbacks there.para.logout() also cancels all active polling, resets the state phases back to unauthenticated, and clears the stored session.
Handling Results
authenticateWithOAuth() returns the same AuthenticateResponse as email/phone auth. See the authentication guide for full response type documentation.