linkIdp method

Future<void> linkIdp(
  1. IdpProvider provider,
  2. Uri requestUri
)

Links a new IDP-Account to this account.

Linking allows a user to add a new login method to an existing account. After doing so, he can choose any of those methods to perform the login.

With this method, an IDP-Provider based account (like google, facebook, twitter, etc.) can be added to allow login with the given provider and requestUri via FirebaseAuth.signInWithIdp(). If the linking fails, an AuthException is thrown.

Implementation

Future<void> linkIdp(
  IdpProvider provider,
  Uri requestUri,
) async {
  final response = await api.linkIdp(
    LinkIdpRequest(
      idToken: _idToken,
      postBody: provider.postBody,
      requestUri: requestUri,
    ),
  );
  _applyToken(
    idToken: response.idToken,
    refreshToken: response.refreshToken,
    expiresIn: response.expiresIn,
  );
}