skip to Main Content

When I trigger the Apple Sign in with the below codes:

Future<UserCredential> signInWithApple() async {
 final appleProvider = AppleAuthProvider();
 appleProvider.addScope('email');
 // appleProvider.setCustomParameters({
 //   'client_id': 'com......firebase', // service ID
 // }); // client_id is reserved
 return await FirebaseAuth.instance.signInWithProvider(appleProvider);
}

It launches the chrome with proper information from the service I created at Apple developer, it seems that the sign in process finishes properly. But when it gets back to the Android App, I get the following error message:

FirebaseAuthException:
Code: invalid-credential,
Message: HttpMetadata{status=400, cachePolicy=NO_CACHE, cacheDurationJava=null, cacheImmutable=false, staleWhileRevalidate=null, filename=null, lastModified=null, retryAfter=null, crossOriginEmbedderPolicy=null, crossOriginOpenerPolicy=null, crossOriginResourcePolicy=null, permissionsPolicies=[], headers=HTTP/1.1 200 OK, contentSecurityPolicies=[], originTrials=[], reportToHeaders=[], varyHeaderNames=[], cookieList=[]}},
StackTrace: null

I have created the keys and services twice and double checked everything with Apple developer, put in the call back as suggested by Firebase with domain.

Put the values in Firebase Auth as it is required, but it seems not to be working and the error persists.

If I cancel the error code is "web-context-canceled" so I think it is okay.

If anybody faced similar issues any suggestion will be greatly appreciated.

2

Answers


  1. Apple sign in for android is kind of redundant imo, but if you still wanna implement it,

    check out: https://pub.dev/packages/sign_in_with_apple

    you might have to Create a Service ID

    it says:

    The Service ID is only needed for a Web or Android integration. If you only intend to integrate iOS you can skip this step.
    
    Login or Signup to reply.
  2. Callback URL Mismatch: The callback URL configured in Firebase and the Android app might not be identical. Double-check the structure (including intent:// and package name).

    Incorrect Service ID: Ensure the Service ID used in the Android app matches the one created in Apple Developer Portal.

    Server-Side Code Issues: The code handling the Apple Sign In callback on the server might have errors in validating the received credential.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search