Skip to main content

nitro-google-signin

Google Sign-In for NitroUI apps. Android uses Credential Manager and AuthorizationClient; iOS uses the Google Sign-In SDK 10. The package is a Nitro 1.0 module (nitro-core) with Swift and Kotlin implementations.

bun add nitro-google-signin

What you get​

CapabilityWhat it does
One-call sign-insignInWithGoogle() restores a returning user and shows Google's account sheet only when there is no saved credential.
Every Google flowsignIn, createAccount, presentExplicitSignIn, requestScopes, signOut and revokeAccess.
Fresh tokensgetTokens() returns an ID token valid for at least five more minutes, and a fresh access token.
Sessions that survive a relaunchgetCurrentUser() reads the session stored in the Keychain or Keystore-encrypted storage, synchronously and offline.
Server auth codesOne-time codes for your backend, from interactive sign-in and requestScopes.
Typed errorsEvery native failure carries a [CODE] tag that getGoogleSignInErrorCode returns as a typed union.

Cancellation is a result, not an error: sign-in methods resolve success, cancelled or noSavedCredential, and reject only on real failures.

Requirements​

  • NitroUI 0.3 or newer: iOS 16+, Android API 26+.
  • nitro-ui-renderer 0.3.0 or newer, the package's peer dependency.
  • Google Sign-In SDK for iOS 10.1, resolved by Swift Package Manager. Its GTMAppAuth 6.0 and AppAuth 3.0 dependencies are held to those minor versions, because clearCachedAccessToken reads their token state.
  • androidx.credentials 1.6, googleid 1.2.0 (1.2.1 needs Kotlin 2.4; NitroUI compiles with 2.2), play-services-auth 22.0.

Next steps​

  1. Install the package and override nitro-core if your NitroUI release pins another nightly.
  2. Create the OAuth clients in Google Cloud.
  3. Wire the client IDs into iOS and Android.
  4. Follow the quick start to sign a user in and send the ID token to your backend.