This feature requires you to configure deeplinks and whitelist your app’s deeplink URL in the Dynamic dashboard. See the steps below.
This guide is for setting up Google social login in your Flutter app. This guide uses Google as an example. To set up other providers (Apple, Discord, Farcaster, GitHub, etc.), see the Social Providers Overview: Social Providers Overview.

1. Enable social login in your Dynamic Dashboard

1.1. Enable Google login in the Dynamic Dashboard

Google login enabled

1.2. Create Google OAuth credentials

  • Go to the Google Cloud Console credentials page
  • Click on “Create credentials”
  • Select “OAuth client ID”
  • Choose “Web application” as the Application type
  • Add the redirect URI from the Dynamic Dashboard Google section to “Authorized redirect URIs”
  • Click “Create”
  • Copy the “Client ID” and “Client Secret”
  • Paste the “Client ID” and “Client Secret” into the Google section in your Dynamic Dashboard
  • Click on “Save”
Google OAuth credentials
Add auth redirect URI

2. Enable deeplinking in your project

Android requires a special setup for social login deeplinks, which is covered below. iOS does not require additional configuration for the basic social login flow.If you want to use HTTPS links or implement more advanced deep linking behavior, follow Flutter’s guide: Flutter Deep Linking.

2.1. Configure AndroidManifest.xml

You need to add a deeplink scheme to your AndroidManifest.xml to enable deep linking in your app. Add the following to your AndroidManifest.xml:
<manifest>
  <application>

    <activity
      android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
      android:exported="true">
      <intent-filter android:label="flutter_web_auth_2">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOUR_CALLBACK_URL_SCHEME_HERE" />
      </intent-filter>
    </activity>

  </application>
</manifest>
Replace YOUR_CALLBACK_URL_SCHEME_HERE with your scheme, for example flutterdemo.

2.2. Remove any android:taskAffinity="" from your AndroidManifest.xml

In your AndroidManifest.xml, remove any android:taskAffinity="" from the activity tag. This prevents a bug on Android where the popup does not close properly. Add redirectUrl to your DynamicSDK.init call so it matches your scheme.
DynamicSDK.init(
  props: ClientProps(
    // Find your environment id at https://app.dynamic.xyz/dashboard/developer
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    redirectUrl: "<YOUR_CALLBACK_URL_SCHEME_HERE>://",
  ),
);
Example with flutterdemo scheme:
DynamicSDK.init(
  props: ClientProps(
    // Find your environment id at https://app.dynamic.xyz/dashboard/developer
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    redirectUrl: "flutterdemo://",
  ),
);
  • Go to the Security page
  • Enable “Mobile Deeplink URL”
  • Add your deeplink pattern to the list, for example flutterdemo://*
  • Click on “Save”
Mobile deeplink URL

4. Run your app

  • Run your app
  • Click on the “Login” button
  • Select “Google”
  • A Google popup should appear
  • Select your Google account
  • You should be redirected to your app and logged in
You can read more about the social module here.

Headless

If you prefer to build your own UI instead of using Dynamic’s pre-built authentication flow, you can use the headless SDK API for social login. Note that steps 1-3 above are still required for headless mode - you still need to configure social providers in the Dynamic Dashboard, enable deeplinking, and whitelist your deeplink scheme. You can use the auth.social.connect method to trigger social authentication programmatically:
import 'package:dynamic_sdk/dynamic_sdk.dart';
import 'package:flutter/material.dart';

class LoginWithGoogleOutlinedButton extends StatelessWidget {
  const LoginWithGoogleOutlinedButton({super.key});

  @override
  Widget build(BuildContext context) {
    return OutlinedButton(
      onPressed: () async {
        // This line will trigger the Google authentication flow
        await DynamicSDK.instance.auth.social.connect(
          provider: SocialProvider.google,
        );
      },
      child: const Text('Continue with Google'),
    );
  }
}

Live Example

For a complete working example, see the Flutter live example: Live Example.