Para supports social login authentication in Flutter applications, allowing users to sign in using popular providers like Google, Apple, Twitter, Discord, and Farcaster. This guide explains how to implement social login in your Flutter app using Para’s Flutter SDK.

The social login flow in mobile applications requires handling browser sessions and deeplinks to redirect users back to your app after successful authentication. Once the social login flow completes, Para uses the returned identifier to authenticate users through the standard email-based flow, creating or authenticating with a native passkey.

Prerequisites

Before implementing social login, ensure you have completed the basic Para setup for your Flutter application.

Configuration

Add URL schemes to your Info.plist file to handle callbacks from authentication:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>YOUR_APP_SCHEME</string>
    </array>
  </dict>
</array>

Replace YOUR_APP_SCHEME with your application’s unique URL scheme (e.g., paraflutter). This scheme must be unique to your application and will be used for redirecting back to your app after authentication.

Implementation

OAuth Authentication

import 'package:para/para.dart';
import 'package:para_flutter/client/para.dart';

// OAuth connection with Para
final oAuthResponse = await para.oAuthConnect(provider, "YOUR_APP_SCHEME");

// For existing users
if (oAuthResponse.userExists) {
  // Login with the email from OAuth response
  final wallet = await para.login(email: oAuthResponse.email);
} 
// For new users
else {
  // Verify OAuth completion
  final biometricsId = await para.verifyOAuth();
  
  // Generate passkey
  await para.generatePasskey(oAuthResponse.email!, biometricsId);
  
  // Create wallet
  final result = await para.createWallet(skipDistribute: false);
}

Social login with Para still requires creating a native passkey to secure the user’s wallets. After social authentication 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.

Available OAuth Providers

Para supports various OAuth providers through the OAuthMethod enum:

// Available OAuth methods
OAuthMethod.google    // Google authentication
OAuthMethod.apple     // Apple authentication
OAuthMethod.twitter   // Twitter (X.com) authentication
OAuthMethod.discord   // Discord authentication

Checking Login Status

You may want to check if a user is already authenticated when your app starts:

// Check if user is logged in
final isLoggedIn = await para.isFullyLoggedIn();

// If logged in, get user wallets
if (isLoggedIn) {
  final wallets = await para.getWallets();
  // Process wallets as needed
}

Examples

Explore our complete example implementations for social login with Para:

Next Steps

After integrating Para, you can explore other features and integrations to enhance your Para experience.