Skip to main content
This feature requires you set up the deeplink URLs whitelist for your Dynamic app. See step 3 here.

Sign up with Social

Sign up/sign in with Apple, Discord, Facebook, Farcaster, Github, Google, Telegram, Twitch or Twitter! Similar to email, you can toggle and configure each social provider in the social providers section of the dashboard. Configuration guides for individual social signup options can be found in the social providers section of the docs.

Using Dynamic UI

You can trigger Social signup/login using the Dynamic UI simply by calling the method to trigger the signup/login flow:
dynamicClient.ui.auth.show()
After the user has signed in successfully, you can also bring up our user profile interface, which allows your user to view their wallet’s address and balance, as well as editing their fields like email and phone number. To show the user profile modal, call:
dynamicClient.ui.userProfile.show()

Headless mode

You can prompt a user to sign up/login/link their social accounts with the connect method in our social module. It returns a promise that resolves with no params on success, and rejects on failure. Here’s how you can connect a user’s farcaster account, for example:
import { ProviderEnum } from '@dynamic-labs/types';

const connectFarcaster = async () => {
  await dynamicClient.auth.social.connect({ provider: ProviderEnum.Farcaster })
}
See here for a list of all our supported social providers — it will be the same list you see in your dashboard.
Not only can this method be used to sign a user in, but it is also able to link a social account to an already signed in user.

Managing linked accounts

You can check, retrieve, and unlink social accounts programmatically using the social module’s methods.

Check if a provider is linked

Use isLinked to check if the user has linked any accounts for a specific provider:
import { ProviderEnum } from '@dynamic-labs/types';

const isGoogleLinked = await dynamicClient.auth.social.isLinked(ProviderEnum.Google);

if (isGoogleLinked) {
  console.log('User has linked a Google account');
}

Get linked accounts for a provider

Use getLinkedAccounts to retrieve all linked accounts for a specific provider:
import { ProviderEnum } from '@dynamic-labs/types';

const googleAccounts = await dynamicClient.auth.social.getLinkedAccounts(ProviderEnum.Google);

googleAccounts.forEach(account => {
  console.log('Account:', account.displayName, account.email);
});

Get all linked accounts

Use getAllLinkedAccounts to retrieve all linked social accounts across all providers:
const allLinkedAccounts = await dynamicClient.auth.social.getAllLinkedAccounts();

console.log(`User has ${allLinkedAccounts.length} linked social accounts`);
Use unlink to remove a linked social account. If the user has multiple accounts linked for the same provider, you can specify which one to unlink using the verifiedCredentialId:
import { ProviderEnum } from '@dynamic-labs/types';

await dynamicClient.auth.social.unlink(ProviderEnum.Google);

const googleAccounts = await dynamicClient.auth.social.getLinkedAccounts(ProviderEnum.Google);
if (googleAccounts.length > 0) {
  await dynamicClient.auth.social.unlink(ProviderEnum.Google, googleAccounts[0].id);
}

Adjusting app name in social connection dialogues

Social connection dialogues will derive the name of your app from the appOrigin prop of the ReactNativeExtension extension you used to initialize your client — read here. So in order for your app’s name to be displayed correctly to your user when they are connecting their social accounts, you need to provide this prop. You can read more about the social module here.
I