Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when not logged into apple on simulator before calling getAppleIdCredentials #302

Open
mich040m opened this issue Apr 8, 2022 · 6 comments

Comments

@mich040m
Copy link

mich040m commented Apr 8, 2022

Not tested on a real device
Tested on iPhone 13 simulator
iOS 15.4

Step. 1
Start iOS simulator, dont be logged into apple on it
Step 2
Call getAppleIDCredential form your application

final result = await SignInWithApple.getAppleIDCredential( scopes: [ AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName, ], );

Result:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: SignInWithAppleAuthorizationError(AuthorizationErrorCode.unknown, The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1000.))

@mich040m mich040m changed the title Exception thrown when not logged into apple on simulator before pressing calling getAppleIdCredentials Exception thrown when not logged into apple on simulator before calling getAppleIdCredentials Apr 8, 2022
@juskek
Copy link

juskek commented Jul 22, 2022

Simulator iOS 15.5 and XCode 13.4.1

No issue for me. Is the exception still thrown on a real device?

image

@Shawn-sudo
Copy link

Same for me. I see the error thrown right after closing the dialog in @juskek 's image

Simulator Screen Shot - iPhone SE (3rd generation) - 2023-02-06 at 19 24 58

(fyi, it's an alert dialog created by my custom code using try-catch)

It says the error is com.apple.AuthenticationServices.AuthorizationError with code 1000, so ig we can add that specific case to be classified as AuthorizationErrorCode.canceled

Or actually, if the enum AuthorizationErrorCode of this package is based on Apple's classification (this one), then it'd be better to keep the current code

@sarathn91
Copy link

same issue here, any solution?

@tp
Copy link
Collaborator

tp commented Feb 27, 2023

It says the error is com.apple.AuthenticationServices.AuthorizationError with code 1000, so ig we can add that specific case to be classified as AuthorizationErrorCode.canceled

Error 1000 refers to the case "UNKNOWN":

https://developer.apple.com/documentation/authenticationservices/asauthorizationerror/code/unknown

So I don't think it's canceled in the sense that the user ended the flow without signing in, but something technically was amiss.

@Ziven-n
Copy link

Ziven-n commented Aug 11, 2023

you can catch the exception like this:

                      try {
                        final result =
                            await SignInWithApple.getAppleIDCredential(
                          scopes: [
                            AppleIDAuthorizationScopes.email,
                            AppleIDAuthorizationScopes.fullName,
                          ],
                        );
                        debugPrint('$result');
                      } on SignInWithAppleAuthorizationException catch (e) {
                        switch (e.code) {
                          case AuthorizationErrorCode.canceled:
                            showToast('');
                            break;
                          default:
                        }
                      }

@SunilKividor
Copy link

any solution for this ? I am getting an unhandled exception in my flutter app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants