getCredentialState always returns an error

Hi there,


I'm experiencing some inconsistent behavior when using Sign in with Apple on my devices, in particular and only recently, every call to `getCredentialState` returns an error. At first I thought it was an issue with our implementation but even with the Juice app I get the exactly same behavior.


Build and run, set a breakpoint on the callback for getCredentialState. Immediately after calling `getCredentialState` the following error is returned:


```

2019-11-08 15:10:56.501547-0500 Juice[80847:972377] [core] Credential State request returned with error: Error Domain=AKAuthenticationError Code=-7001 "(null)"

```

Then when I hit the breakpoint inside the closure, inspecting the error object returns this


```

(lldb) po error

▿ Optional<Error>

- some : Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1000 "(null)"

```


And finally when continuing the executing, this is also printed in the console:


```

2019-11-08 15:11:02.116122-0500 Juice[80847:972381] [core] Authorization failed: Error Domain=AKAuthenticationError Code=-7001 "(null)" UserInfo={AKClientBundleID=com.example.apple-samplecode.juice35R365FS4Q}

```


I tried running this on the simulator and a real device, in both Debug and Release configurations all with the same result.

Despite the error above I am still able to successfuly Sign in with Apple but obviously I need the call to getCredentialState to work so I can decide on which flow to take on app startup.


For what it's worth this exact same call worked a few days ago so I don't know if there is some sort of inconsistent state related to the account I am using or an issue on Apple's side.


Is there anything else I should be trying?

Thanks

Rog

Replies

So it turns out this was a race condition on my end due to some unexpected behavior of the `credentialsRevoked` notification, which seems to be broadcast for every successful login.


At first I thought it was due to it revoking a previous/existing credential during the sign in process but I am seeing this happen even when a user Signs in with Apple for the first time.


Can anyone confirm that this is the intended behavior?

Having similar problem. Did you ever figure this one out?
yesterday I did able to sign in but today can't sign in, so I went back to the juice sample code for app which was functioning yesterday but today that it is not functioning.

anyone find out the issue?