signInWithSocialCredential method
Future<String?>
signInWithSocialCredential(
- BuildContext context, {
- required AuthenticatedUser user,
- required String idToken,
- AuthToken? token,
- String? authCode,
- String? rawNonce,
Sign in with credentials from providers (e.g. Google, Apple) or via Firebase
Implementation
Future<String?> signInWithSocialCredential(BuildContext context,
{required AuthenticatedUser user,
required String idToken,
AuthToken? token,
/// Optional string but required to complete Firebase Auth Sign-In with Apple flow.
///
/// This is the authorization code returned by Apple Sign In and will be used to authenticate with Firebase as the accessToken.
///
/// Can be `null` since it only applies to Apple Sign In
/// See [Firebase docs](https://firebase.google.com/docs/auth/ios/apple#sign_in_with_apple_and_authenticate_with_firebase) for more information.
/// Inspriration from [Mediuam](https://medium.com/@muhammad.fathy/resolving-the-firebase-auth-invalid-credential-invalid-oauth-response-from-apple-com-6bca6b6a8575)
String? authCode,
/// Optional string which, if set, will be be embedded in the resulting `identityToken` for Firebase Auth Sign-In with Apple flow.
///
/// This can be used to mitigate replay attacks by using a unique argument per sign-in attempt.
///
/// Can be `null`, in which case no nonce will be passed to the request.
/// See [Firebase docs](https://firebase.google.com/docs/auth/ios/apple#sign_in_with_apple_and_authenticate_with_firebase) for more information.
String? rawNonce}) async {
if (user.provider == null || user.provider == SignInProvider.local) {
return _signInLocally(context, user: user);
} else if (user.provider == SignInProvider.firebase) {
return _signInWithFirebase(context, user: user, idToken: idToken, authCode: authCode, rawNonce: rawNonce);
}
// else if (user.provider == SignInProvider.auth0) {
// return _updateCurrentUser(context, user);
// }
return null;
}