Skip to main content

Errors and troubleshooting

Nitro carries only an error's message across the native bridge, so every native failure starts with a [CODE] tag, for example:

[IN_PROGRESS] Another Apple sign-in is already running.

getAppleSignInErrorCode(error) reads the tag back and returns an AppleSignInErrorCode, or undefined for anything else.

import { AppleSignIn, getAppleSignInErrorCode } from 'nitro-apple-signin'

try {
const credential = await AppleSignIn.signIn({ scopes: ['email'] })
if (credential === undefined) return // cancelled: not an error
} catch (error) {
switch (getAppleSignInErrorCode(error)) {
case 'IN_PROGRESS':
return // a sign-in is already showing
case 'SIGN_IN_FAILED':
showMessage('Sign in with Apple failed. Check your Apple ID in Settings.')
return
default:
throw error
}
}

Codes​

CodeMeaning
NOT_SUPPORTEDAndroid: no Sign in with Apple.
NO_PRESENTERNo foreground window can show the sign-in sheet.
IN_PROGRESSAnother sign-in is still running.
SIGN_IN_FAILEDApple could not complete the sign-in, such as a missing entitlement or no Apple ID on the device.
CREDENTIAL_STATE_FAILEDApple could not report the credential state.

A SIGN_IN_FAILED message ends with the underlying ASAuthorizationError number, for example (ASAuthorizationError 1000).

Troubleshooting​

SIGN_IN_FAILED with ASAuthorizationError 1000​

AuthenticationServices reports all of these as the same unknown error:

  • The app lacks the com.apple.developer.applesignin entitlement. See iOS setup.
  • The App ID does not have Sign in with Apple enabled.
  • The device or simulator is not signed in to an Apple ID.

notFound from getCredentialState​

The user ID belongs to another app or developer team, or the device is signed in to another Apple ID.

NOT_SUPPORTED on Android​

Expected. Apple offers no native Sign in with Apple on Android. Check AppleSignIn.isSupported() before showing the button.

IN_PROGRESS on a double tap​

A second signIn call while the sheet is showing rejects. Disable the button while sign-in runs, as the example button does.

Reporting a bug​

Open an issue with the bug template. Include the code from getAppleSignInErrorCode(error) and the full error message.