aboutyou / dart_packages

Dart and Flutter plugins maintained and used by @ABOUTYOU
222 stars 153 forks source link

sign_in_with_apple: getCredentialState always returns authorized #402

Closed antontishkov closed 9 months ago

antontishkov commented 9 months ago

Apple reveals user name and email only for the very first authorisation attempt. So my steps to reproduce the issue are the following:

  1. Stop using Apple Sign In for my app here https://appleid.apple.com/account/manage
  2. Call getCredentialState:
    final result = await SignInWithApple.getCredentialState('my_userIdentifier');
    print(result);

It always returns "CredentialState.authorized"... but why?

Testing on iPhone 15 Pro (ios simulator).

tp commented 9 months ago

Are you executing step 1 and 2 in immediate succession?

I would guess there is just a time delay between signing out via the website and your local device (or simulator) updating the state (as this is likely cached, so it would also continue to work offline).

Have you tried logging out from the device instead? From my recollection of earlier tests that is reflected immediately.

antontishkov commented 9 months ago

Are you executing step 1 and 2 in immediate succession?

I tried this many times with different time gaps. Unfortunately the result always the same.

Looks like the problem is only in iOS Simulator. With the real device everything is working as expected.

tp commented 9 months ago

Okay, then I would see this issue more as documentation for others experiencing similar problems, as I don't think there is something to be done on the client to react quicker to a change on web. (Otherwise I'd appreciate a link to the Apple docs, so we could add the same support in here.)

Generally there are a bunch of quirks when testing SiwA with the iOS simulator, and thus I would recommend to use a physical device whenever possible.