Flutter Sign in with apple failure

5,002

Apparently Apple provides the fullName and email fields for the first sign in only. These fields will be null for subsequent sign ins.

However, you may opt to get the fullName through appleIDCredential.fullName in didCompleteWithAuthorization delegate method, and update the user's profile yourself.

Source: https://github.com/firebase/firebase-ios-sdk/issues/4393#issuecomment-559012512

Share:
5,002
MNFS
Author by

MNFS

Updated on December 17, 2022

Comments

  • MNFS
    MNFS over 1 year

    i implement sign in with apple on my apps, for some reason my server return error cause username length from sign in with apple didn't meet my condition and i didn't cache the information of the user. After that i update the server to remove username length requirement, but unfortunately user name and email is null? The solution i know is to stop using apple id from setting page on Iphone, is there any other solution from code? here is my code :

    AppleSignInButton(
      style: ButtonStyle.whiteOutline,
      cornerRadius: 8,
      type: ButtonType.signIn,
      onPressed: () async {
        var isConnected = await checkConnection();
        if (!isConnected) {
            showErrorDialog(message: ErrorMessage.NO_NETWORK);
        } else {
            final AuthorizationResult result = await AppleSignIn.performRequests([
                    AppleIdRequest(requestedScopes: [Scope.email, Scope.fullName])
            ]);
    
            if (result != null) {
                switch (result.status) {
                    case AuthorizationStatus.authorized:
                        _loginWithApple(result.credential);
                        break;
                    case AuthorizationStatus.cancelled:
                        break;
                    case AuthorizationStatus.error:
                        showErrorDialog(message: result.error.localizedFailureReason);
                        break;
                }
            } else {
                showErrorDialog(message: result.status.toString(), onTap: (){});
            }
        }
    },)