ios – How one can SILENTLY sign up with apple in flutter?


I’ve constructed an app by which the customers can log in utilizing Google, E-mail/Password, and Apple, utilizing Firebase Auth.

For the Google Register, I get the credentials utilizing

closing GoogleSignInAccount? googleUser = await GoogleSignIn(clientId: clientId).signIn();
closing GoogleSignInAuthentication? googleAuth = await googleUser?.authentication;
closing oauthCredential = GoogleAuthProvider.credential(
      accessToken: googleAuth?.accessToken,
      idToken: googleAuth?.idToken,
    );
await FirebaseAuth.occasion.signInWithCredential(oauthCredential);

And for the Apple Register, I exploit the sign_in_with_apple bundle as described right here:

AuthorizationCredentialAppleID appleCredential = await SignInWithApple.getAppleIDCredential(
        scopes: [
          AppleIDAuthorizationScopes.email,
          AppleIDAuthorizationScopes.fullName,
        ],
        nonce: nonce,
      );
closing oauthCredential = OAuthProvider("apple.com").credential(
        idToken: appleCredential.identityToken,
        rawNonce: rawNonce,
      );
await FirebaseAuth.occasion.signInWithCredential(oauthCredential);

This works wonderful to this point for signing within the consumer after they affirm the login popup.

Now I need to add silent sign up (= sign up with the saved credentials with out consumer interplay) to each Google an Apple.
To do that I save the oAuthCredential after successfull login, and when the app is began the following time, I load it and name

await FirebaseAuth.occasion.signInWithCredential(oAuthCredential);

to signal within the consumer. For Google this works completely wonderful, however on iOS for the Apple Signal In, I get this Firebase Auth error:

missing-or-invalid-nonce: Duplicate credential obtained. Please strive once more with a brand new credential.

I’ve googled for ages however have not discovered something useful. What’s the issue right here?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles