postBody property

String get postBody

Generates a HTTP-POST body to be used by the REST-API.

The postBody is used by FirebaseAuth.signInWithIdp() to convert the provider to what is needed by the REST-API. This typically contains the provider id as well as provider-specific parameters as specified in the factory constructors.

Implementation

String get postBody {
  final params = when(
    google: (idToken) => {'id_token': idToken},
    facebook: (accessToken) => {'access_token': accessToken},
    twitter: (accessToken, oauthTokenSecret) => {
      'access_token': accessToken,
      'oauth_token_secret': oauthTokenSecret,
    },
    custom: (_, parameters) => parameters,
  );
  return Uri(
    queryParameters: <String, dynamic>{
      ...params,
      'providerId': id,
    },
  ).query;
}