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
| Capability | What it does |
|---|---|
| One-call sign-in | signInWithGoogle() restores a returning user and shows Google's account sheet only when there is no saved credential. |
| Every Google flow | signIn, createAccount, presentExplicitSignIn, requestScopes, signOut and revokeAccess. |
| Fresh tokens | getTokens() returns an ID token valid for at least five more minutes, and a fresh access token. |
| Sessions that survive a relaunch | getCurrentUser() reads the session stored in the Keychain or Keystore-encrypted storage, synchronously and offline. |
| Server auth codes | One-time codes for your backend, from interactive sign-in and requestScopes. |
| Typed errors | Every 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-renderer0.3.0 or newer, the package's peer dependency.- Google Sign-In SDK for iOS 10.1, resolved by Swift Package Manager. Its
GTMAppAuth6.0 andAppAuth3.0 dependencies are held to those minor versions, becauseclearCachedAccessTokenreads their token state. androidx.credentials1.6,googleid1.2.0 (1.2.1 needs Kotlin 2.4; NitroUI compiles with 2.2),play-services-auth22.0.
Next steps
- Install the package and override
nitro-coreif your NitroUI release pins another nightly. - Create the OAuth clients in Google Cloud.
- Wire the client IDs into iOS and Android.
- Follow the quick start to sign a user in and send the ID token to your backend.