Google Sign-In
for NitroUI.
Credential Manager on Android and the Google Sign-In SDK on iOS, behind one typed API. Returning users, incremental scopes, fresh tokens and server auth codes.
bun add nitro-google-signinTwo platforms. One API.
The library wraps each platform's current Google identity SDK and smooths over the differences that matter to your app.
Credential Manager
Sign-in, auto-select and ID token refresh, with scopes from AuthorizationClient.
Google Sign-In SDK 10
Silent restore, ASWebAuthenticationSession, no app delegate URL handling.
One call
Restores a returning user, and shows the account sheet only when there is no saved credential.
Swift + Kotlin
A HybridObject spec with native implementations on both platforms, bound by Nitrogen.
Everything the sign-in flow needs
From the first tap to the token your backend verifies, with the same TypeScript API on Android and iOS.
Returning users
signIn() restores the previous account; enableAutoSelect skips the Android sheet for one account.
Incremental scopes
requestScopes() asks for Google API access when a feature needs it, not at sign-in.
Server auth codes
One-time codes from interactive sign-in and requestScopes, for refresh tokens on your backend.
Fresh tokens
getTokens() returns an ID token valid for at least five more minutes on both platforms.
Stored sessions
getCurrentUser() is synchronous and offline, from the Keychain or Keystore-encrypted storage.
Typed errors
Every native failure carries a [CODE] tag; getGoogleSignInErrorCode() returns a typed union.
Cancellation is a result
Sign-in resolves success, cancelled or noSavedCredential. Only real failures reject.
Branded button
A copy-paste "Sign in with Google" button built from NitroUI views, per Google’s guidelines.
From tap to backend in three lines
Configure once, sign in from your button, and hand a fresh ID token to every request. The full API is there when the helpers are not enough.
Read the guidesimport { getIdToken, GoogleSignIn, signInWithGoogle } from 'nitro-google-signin'
// Once at startup. Client IDs come from the native config.
GoogleSignIn.configure()
// From your sign-in button. undefined when the user cancels.
const session = await signInWithGoogle()
if (session !== undefined) await sendToBackend(session.idToken)
// Per request: valid for at least five more minutes.
const idToken = await getIdToken() // undefined when signed out
Ship Google Sign-In today.
Create the OAuth clients, add three keys to .env, and call signInWithGoogle().