Errors
import {
appleSignInErrorCodes,
getAppleSignInErrorCode,
type AppleSignInErrorCode,
} from 'nitro-apple-signin'
| Export | Kind | Summary |
|---|---|---|
getAppleSignInErrorCode | function | Reads the [CODE] tag of an AppleSignIn error. |
AppleSignInErrorCode | type | Union of every error code. |
appleSignInErrorCodes | constant | Every code, as a readonly array. |
getAppleSignInErrorCode
function getAppleSignInErrorCode(error: unknown): AppleSignInErrorCode | undefined
Returns the code of an error thrown or rejected by AppleSignIn, or undefined for any other value: a non-Error, an untagged message, or a tag that is not a known code.
It reads the tag at the start of the message, and also accepts the forms the bridge produces:
| Message | Result |
|---|---|
[IN_PROGRESS] Another Apple sign-in is ... | IN_PROGRESS |
signIn: [NOT_SUPPORTED] Android has no ... (synchronous throw) | NOT_SUPPORTED |
[NOT_SUPPORTED] ... followed by a Kotlin stack trace | NOT_SUPPORTED |
[NOT_CONFIGURED] ... | undefined |
plain failure | undefined |
a string, not an Error | undefined |
AppleSignInErrorCode
type AppleSignInErrorCode =
'NOT_SUPPORTED' | 'NO_PRESENTER' | 'IN_PROGRESS' | 'SIGN_IN_FAILED' | 'CREDENTIAL_STATE_FAILED'
| Code | Meaning |
|---|---|
NOT_SUPPORTED | The platform has no Sign in with Apple (Android). |
NO_PRESENTER | No foreground window can present the sign-in sheet. |
IN_PROGRESS | Another sign-in is already running. |
SIGN_IN_FAILED | Apple could not complete the sign-in, such as when the app lacks the entitlement or the device has no Apple ID. |
CREDENTIAL_STATE_FAILED | Apple could not report the credential state. |
appleSignInErrorCodes
const appleSignInErrorCodes: readonly [
'NOT_SUPPORTED',
'NO_PRESENTER',
'IN_PROGRESS',
'SIGN_IN_FAILED',
'CREDENTIAL_STATE_FAILED',
]
Every code AppleSignIn writes into the [CODE] tag of its messages. AppleSignInErrorCode is derived from it.