Credential state
A user can stop using their Apple ID with your app at any time from Settings. getCredentialState(userId) asks Apple whether the stored user still authorizes the app.
const state = await AppleSignIn.getCredentialState(storedUserId)
switch (state) {
case 'authorized':
break
case 'revoked':
case 'notFound':
signOut()
break
case 'transferred':
migrateUser(storedUserId) // the app moved to another developer team
break
}
Call it on launch with the credential.user you saved after sign-in.
States
| State | Meaning | Typical action |
|---|---|---|
authorized | The user is signed in. | Continue. |
revoked | The user stopped using Apple ID with this app. | Sign out. |
notFound | The user never signed in to this app with this Apple ID, or the device has no Apple ID. | Sign out. |
transferred | The app moved to another developer team. | Migrate the user's ID. |
:::info notFound for a valid user
notFound also appears when the user ID belongs to another app or developer team, or when the device is signed in to a different Apple ID.
:::
Failures
When Apple cannot report a state, the promise rejects with CREDENTIAL_STATE_FAILED. Treat it as "unknown", not as signed out: retry later instead of clearing the session. On Android it rejects with NOT_SUPPORTED.