failed to get credential.state and getCredentialStateForUserID


I can't get the credentialState from method getCredentialStateForUserID while other members got returned well.

I ran the app on iPhone 8, iOS 13 simulator.

<pre class="lang-c prettyprint-override">- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization { if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) { ASAuthorizationAppleIDCredential *credential = authorization.credential; NSString *state = credential.state; NSString *userID = credential.user; [[NSUserDefaults standardUserDefaults] setValue:userID forKey:currentAppleId]; NSPersonNameComponents *fullName = credential.fullName; NSString *email = credential.email; NSString *authorizationCode = [[NSString alloc] initWithData:credential.authorizationCode encoding:NSUTF8StringEncoding]; // refresh token NSString *identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding]; // access token ASUserDetectionStatus realUserStatus = credential.realUserStatus; NSLog(@"state: %@", state); NSLog(@"userID: %@", userID); NSLog(@"fullName: %@", fullName); NSLog(@"email: %@", email); NSLog(@"authorizationCode: %@", authorizationCode); NSLog(@"identityToken: %@", identityToken); NSLog(@"realUserStatus: %@", @(realUserStatus)); ASAuthorizationAppleIDProvider *appleIDProvider = [ASAuthorizationAppleIDProvider new]; if (userID) { NSString* __block errorMsg = nil; [appleIDProvider getCredentialStateForUserID:userID completion:^(ASAuthorizationAppleIDProviderCredentialState credentialState, NSError * _Nullable error) { switch (credentialState) { case ASAuthorizationAppleIDProviderCredentialRevoked: errorMsg = @"revoked"; break; case ASAuthorizationAppleIDProviderCredentialAuthorized: errorMsg = @"completed well"; break; case ASAuthorizationAppleIDProviderCredentialNotFound: errorMsg = @"credential not found"; break; } dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"SignInWithApple state"); NSLog(@"%@", errorMsg); }); }]; } } }

state: (null)

realUserStatus: 1 (ASUserDetectionStatusUnknown)

Why am I receiving this inappropriate values? any other values get returned well.

and I'm getting this error

2019-09-09 16:28:05.859082+0900 AppleSignin[57581:3353025] [core] Credential State request returned with error: Error Domain=AKAuthenticationError Code=-7001 "(null)"


Same happened to me and after some testing I discovered that it started to work when I used a device for testing. Also, on Simulator it would ALWAYS ask for Name/Email every time, even though the user had already granted that. This was also solved when I switched to a device: after the first time, the user won't get asked to grant permissions again, instead he will have to provide his PIN/Password to login. Hope this helps!



  • Spark Window Functions - rangeBetween dates
  • NoReverseMatch at /main/insert_num/ Django
  • Partitioner for JdbcCursorItemReader - Reader must be open before it can be read
  • facebook login returns code as variable in query string
  • Docker container is killed after ~1 minute
  • DB Schema for Dynamic Categories
  • captions in own div outside of slider
  • Can't ctrl drag Views to header file
  • Custom sort order in SQL Server mixed datatypes stored in a varchar
  • What to use instead of Class.newInstance()?
  • Java: Regex for Parsing Positive and Negative Doubles
  • How do you set up the correct HTTP Response object for a Range request coming from BITS (Background
  • How to make the landscape view look same as the portraitView while using a splitViewController?
  • Calculating distance between 400 cities and optimizing MySQL for it?
  • GBP pound symbol appearing as uknown char in shop
  • Repeating Texture on Model/Mesh
  • Why does the same exact query produce 2 different MySQL explain results?
  • Difference between Canvas and Grid to Move, Resize, Rotate UIElements
  • Regular expression breakpoint in GDB
  • How to add volume slider to android action bar?
  • Define a symbol for an assembly (.s) source file in Android.mk?
  • sql server back restore - login failed
  • Highlight special word in a TextBox
  • Converting a self subquery to a self join
  • What is need of Assign/Deassign in Verilog?
  • Google Geocoding API limit exceeded on cell network, but not on wifi
  • Holoviews plot not rendered in cell in JupyterLab
  • Inet6Address valid for invalid IPv6 Address
  • Please update your Node runtime to version >=0.12.x
  • Connect to a local database from phpmyadmin with R
  • Create an Office365 mailbox from within C# Web API method
  • SQL Server version 612 , 655?
  • What Exception is thrown on timeout?
  • How to use FirstOrDefault inside Include