authenticateWithOAuth signs a user up or in with an OAuth provider and returns once they have an active session. Para runs the provider sign-in, any credential setup, and wallet creation. Add social login alongside email and phone so users see every sign-in option in one place.
This guide covers:
- The recommended single-call flow with
authenticateWithOAuth - The manual
verifyOAuthalternative
Before You Start
- Complete the base setup so your app has a custom URL scheme and a shared
FlutterWebAuthSession(). - If your app offers passkeys, configure them as described in the .
- Add social buttons alongside your email/phone inputs; users should see all auth options together.
Authenticate with a Single Call (Recommended)
CallauthenticateWithOAuth(provider:, webAuthenticationSession:) with the provider the user picked. It works for both new and returning users and returns the same AuthenticationResult as authenticateWithEmailOrPhone, with the user’s userId and whether this sign-in created the account (isNewUser).
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 signs in with the provider on a Para-hosted page shown in the
webAuthenticationSession. A new user then creates their first credential the same way as with email or phone: the native passkey prompt when your app offers passkeys and the device can create one, otherwise a password or PIN on a Para-hosted page (see ). Closing the setup page or the passkey prompt cancels sign-in. A returning user whose account is protected by a passkey is returned to your app and signs in with the native passkey prompt. That passkey must belong to the account the provider signed in. A returning password user unlocks on a Para-hosted page. - Provider sign-in, then passkey in your app. The SDK runs the same flow as
verifyOAuth: the user signs in with the provider in a system browser sheet, then a new user creates a passkey and a returning user signs in with theirs.
Example
lib/views/authentication_view.dart
Handle errors
authenticateWithOAuth throws when sign-in can’t finish. Common cases:
- A user is already signed in (
already_authenticated). On Para’s updated authentication flow the call throws instead of starting a new sign-in. Calllogout()first. - The user cancels. Closing the provider or Para-hosted sheet throws
auth_cancelledon Para’s updated authentication flow andoauth_cancelledon the provider-then-passkey flow. Canceling the passkey prompt throwspasskey_cancelled. - The wrong passkey (
passkey_account_mismatch). When a returning user is asked for their passkey and picks one that belongs to a different account, the call throws and that sign-in is discarded. The user can try again with the right passkey. - The account requires login 2FA (
two_factor_required) on the provider-then-passkey flow. See .
authenticateWithOAuth again right away.
Manual Alternative: verifyOAuth
verifyOAuth(provider:, appScheme:) keeps working unchanged. It always runs the provider sign-in followed by a passkey in your app (a new user creates a passkey, a returning user signs in with theirs), and doesn’t use Para’s updated authentication flow, so new integrations should prefer authenticateWithOAuth. It returns the AuthState the provider sign-in resolved to.
lib/views/authentication_view.dart
Provider Enum Reference
Enable the providers you want to offer for your app in the .