androidflutterfirebase-authenticationsign-in-with-apple

Problem configuring Flutter "sign_in_with_apple" for android


I am trying to set up the Flutter sign_in_with_apple package but run into problems with the android side.

What I have done so far, following the package README to the letter:

  1. Set up the glitch.me server. The server is up and listening at https://MYSERVER.glitch.me/callbacks/sign_in_with_apple I've added a bit of console logging to make sure I know when the server is hit.
  2. Set up appid and serviceid on the apple developer console. Service identifier is com.company.foobar.dev.signin
  3. Added the glitch callback https://MYSERVER.glitch.me/callbacks/sign_in_with_apple as the return url on the service configuration.
  4. Copied the activity block from the readme into my android manifest. NOTE: I didn't know what to set the name. Leave it referring to the package or change it to my app id? It's currently android:name="com.aboutyou.dart_packages.sign_in_with_apple.SignInWithAppleCallback"
  5. Add this block to my flutter service:
          "https://MYSERVER.glitch.me/callbacks/sign_in_with_apple";
      final appleIdCredential = await SignInWithApple.getAppleIDCredential(
          scopes: [
            AppleIDAuthorizationScopes.email,
            AppleIDAuthorizationScopes.fullName,
          ],
          webAuthenticationOptions: WebAuthenticationOptions(
              clientId: "com.company.foobar.dev.signin",
              redirectUri: Uri.parse(redirectURL)));

Unfortunately, the call to SignInWithApple.getAppleIDCredential in step 5 throws an exception and I am seeing invalid_request invalid web redirect url. The glitch server is never even hit, which makes me think that even if I messed up at Step 4 (the intent name in the android manifest) the problem is more likely in the apple developer console setup. However, I am pretty sure I've followed the README and I am running out of ideas.

enter image description here


Solution

  • Hmmm, I threw away the apple developer console service setup for the dev package (with applicationIdSuffix '.dev' and bundleid 'com.company.foobar.dev') and set up the same for the production flavor. This one works as expected.

    I am now wondering if apple doesn't even redirect the request to the glitch server for android unless the package has as playstore presence. Comments?