Skip to main content

Errors

Nitro carries only an error's message across the bridge, so every native failure starts with a [CODE] tag. getGoogleSignInErrorCode(error) returns it as a typed GoogleSignInErrorCode, or undefined for any other value:

import { getGoogleSignInErrorCode, GoogleSignIn } from 'nitro-google-signin'

try {
await GoogleSignIn.revokeAccess()
} catch (error) {
switch (getGoogleSignInErrorCode(error)) {
case 'SIGN_IN_REQUIRED':
return // already signed out
case 'NO_PRESENTER':
return retryWhenForeground()
default:
throw error
}
}

The helper accepts every shape the bridge produces: a rejected promise ([CODE] message), a synchronous throw prefixed with the method name (configure: [CODE] message), and Android messages with a Kotlin stack trace appended.

Cancelling the account sheet is not an error: sign-in methods resolve { type: 'cancelled' }. SIGN_IN_CANCELLED rejections come from consent screens and the Android ID token refresh.

Troubleshooting​

Most sign-in failures come from the Google Cloud setup, not the library.

SymptomFix
DEVELOPER_ERROR on AndroidRegister the package name and the SHA-1 of every signing key on the Android client. webClientId must be the Web application client ID.
DEVELOPER_ERROR on iOSRegister the reversed iOS client ID under CFBundleURLTypes in Info.plist.
cancelled right after picking an account on AndroidCredential Manager reports a missing SHA-1 as a cancellation. Add the SHA-1 of the key that signed this build.
NOT_CONFIGUREDCall configure first, and check that .env has a non-empty client ID and the app was rebuilt after editing it.
PLAY_SERVICES_NOT_AVAILABLEUse a device or emulator image with Google Play services; call checkPlayServices() to show Google's fix-up dialog.

Reporting a bug? Use the bug template and include the error code from getGoogleSignInErrorCode(error) and the full error message.