Implementing OAuth login with Para in React Native and Expo applications
Para supports OAuth authentication in React Native and Expo applications, allowing users to sign in using popular providers like Google, Discord, and Farcaster. This guide explains how to implement OAuth login in your mobile app using Paraβs React Native SDK.
The OAuth flow in mobile applications requires handling browser sessions and deeplinks to redirect users back to your app after successful authentication. Once the OAuth flow completes, Para uses the returned email to authenticate users through the standard email-based flow, creating or authenticating with a native passkey.
Both react-native-inappbrowser-reborn and expo-web-browser use secure browser implementations that leverage the deviceβs native browser engine rather than a WebView. This provides stronger security protections, including shared security context with the deviceβs browser, protection against common web vulnerabilities, and support for modern authentication methods.
Both react-native-inappbrowser-reborn and expo-web-browser use secure browser implementations that leverage the deviceβs native browser engine rather than a WebView. This provides stronger security protections, including shared security context with the deviceβs browser, protection against common web vulnerabilities, and support for modern authentication methods.
The browser packages used for OAuth share cookies, cache, and session data with the deviceβs native browser. This means users already logged into OAuth providers in their device browser will stay logged in. If you encounter authentication issues, try clearing the cache and history in the deviceβs native browser.
import { para } from "../your-para-client";import { OAuthMethod } from "@getpara/react-native-wallet";import { openAuthSessionAsync } from "expo-web-browser";const APP_SCHEME = "your-app-scheme";async function handleOAuthLogin(provider: OAuthMethod) { if (provider === OAuthMethod.FARCASTER) { return handleFarcasterLogin(); } const oauthUrl = await para.getOAuthURL({ method: provider, deeplinkUrl: APP_SCHEME, }); await openAuthSessionAsync(oauthUrl, APP_SCHEME, { preferEphemeralSession: false, }); const { email, userExists } = await para.waitForOAuth(); if (userExists) { await para.login({ email: email! }); // Navigate to your authenticated screen } else { const biometricId = await para.getSetUpBiometricsURL({ isForNewDevice: false, authType: "email", }); if (biometricId) { await para.registerPasskey({ email: email!, biometricsId: biometricId }); // Navigate to your authenticated screen } }}
OAuth authentication with Para still requires creating a native passkey to secure the userβs wallets. After OAuth completes, Para associates a native passkey with the userβs account. For returning users, the native passkey is used for authentication. The passkey is associated on a per-app basis, making authentication streamlined, and users will only see passkey options they created for your specific app.