Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Link User Identities - Flutter SDK

On this page

  • Example

Atlas App Services provides multiple authentication providers to log users into your app. Each provider creates a unique user identity. App Services lets you merge multiple credentials into one user identity.

You can link identities by passing the Credentials that you want to link to User.linkCredentials().

final linkedCredentialUser =
await user.linkCredentials(additionalCredentials);

Consider an application that offers anonymous login. This allows users to explore the app without registering. If users like the application, they create permanent accounts. They sign up with SSO or email/password authentication. By default, this creates a new User object. The app must link the new identity with the original User.

We must first register the new email/password user before linking.

// on app start without registration
final anonymousUser = await app.logIn(Credentials.anonymous());
// ... user interacts with app
//... user decides to sign up for app with email/password auth
final authProvider = EmailPasswordAuthProvider(app);
await authProvider.registerUser(USERNAME, PASSWORD);
// link email/password credentials to anonymous user's credentials
final linkedCredentialUser = await anonymousUser
.linkCredentials(Credentials.emailPassword(USERNAME, PASSWORD));
← Work with Multiple Users - Flutter SDK

On this page