linkCredentials

abstract suspend fun linkCredentials(credentials: Credentials): User

Links the current user with a new user identity represented by the given credentials.

Linking a user with more credentials mean the user can login with either of these credentials. It also makes it possible to upgrade an anonymous user by linking it with e.g. Email/Password credentials.

Example:

val app = new App("app-id")
val user: User = app.login(Credentials.anonymous());
user.linkCredentials(Credentials.emailPassword("email", "password"));

Note: It is not possible to link two existing Atlas App Service users. The provided credentials must not be used by another user.

Return

the User the credentials were linked to.

Parameters

credentials

the credentials to link with the current user.

Throws

if no user is currently logged in.

if linking the two credentials are not supported.

if a failure occurred when communicating with App Services. See AppException for details.