{"_id":"@dulcetlabs/react-native-google-signin","_rev":"2-7b3d7651f77d1ea6e65089d8dbc6a56c","name":"@dulcetlabs/react-native-google-signin","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@dulcetlabs/react-native-google-signin","version":"1.0.0","keywords":["react-native","google-signin","google-sign-in","google-login","credential-manager","sign-in-with-google","auth","authentication","oauth","oauth2","openid-connect","android"],"author":{"name":"Dulcet Labs"},"license":"MIT","_id":"@dulcetlabs/react-native-google-signin@1.0.0","maintainers":[{"name":"nicksol","email":"soldulcetlabs@gmail.com"}],"homepage":"https://github.com/Dulcet-Labs/react-native-google-signin#readme","bugs":{"url":"https://github.com/Dulcet-Labs/react-native-google-signin/issues"},"dist":{"shasum":"2bcb67f673fd7556dc26b66c14c76046fbe84fa1","tarball":"https://registry.npmjs.org/@dulcetlabs/react-native-google-signin/-/react-native-google-signin-1.0.0.tgz","fileCount":37,"integrity":"sha512-PFCktcDG8gjN7CulJAU9Vs0qPFGwXVqXHxdPZ0NTB2EkGnZrhMLwyP7ZV8vFd9yIQLaI/OyuY0QVDVtS1fhHOg==","signatures":[{"sig":"MEUCIGCdqBwcfk9kbwefKgYTjAjHvQT2Pwae6X6ninq0QEp5AiEAzV3LIkCmFtZAOqoC99yTTgLxrlQ/10KvRTJTT5GIAE4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":198720},"jest":{"roots":["<rootDir>/src"],"testMatch":["**/__tests__/**/*.test.ts"],"transform":{"^.+\\.tsx?$":"@swc/jest"},"testEnvironment":"node","moduleNameMapper":{"^react-native$":"<rootDir>/src/__mocks__/react-native.ts"}},"main":"src/index.ts","types":"lib/index.d.ts","source":"src/index.ts","gitHead":"bdea59a9f4a20aa642fdaa1faefea9eb54f3be85","scripts":{"test":"jest","typecheck":"tsc --noEmit","test:watch":"jest --watch","prepublishOnly":"tsc"},"_npmUser":{"name":"nicksol","email":"soldulcetlabs@gmail.com"},"repository":{"url":"git+https://github.com/Dulcet-Labs/react-native-google-signin.git","type":"git"},"_npmVersion":"10.9.2","description":"A premium, Google-compliant Sign-In library for React Native. Dual-flow support — modern Credential Manager + classic GoogleSignInClient. Built directly on Google's official SDKs with no hacks.","directories":{},"_nodeVersion":"22.17.1","react-native":"src/index.ts","publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","react":"^18.0.0","ts-jest":"^29.4.12","@swc/core":"^1.15.47","@swc/jest":"^0.2.39","typescript":"^7.0.2","@types/jest":"^30.0.0","@types/react":"^19.2.18","react-native":"^0.86.2","@types/react-native":"^0.72.8"},"peerDependencies":{"react":">=17.0.0","react-native":">=0.65.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-google-signin_1.0.0_1785747102746_0.7383371427628884","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dulcetlabs/react-native-google-signin","version":"1.0.1","description":"A premium, Google-compliant Sign-In library for React Native. Dual-flow support — modern Credential Manager + classic GoogleSignInClient. Built directly on Google's official SDKs with no hacks.","main":"src/index.ts","react-native":"src/index.ts","source":"src/index.ts","types":"lib/index.d.ts","keywords":["react-native","google-signin","google-sign-in","google-login","credential-manager","sign-in-with-google","auth","authentication","oauth","oauth2","openid-connect","android"],"author":{"name":"Dulcet Labs"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Dulcet-Labs/react-native-google-signin.git"},"homepage":"https://github.com/Dulcet-Labs/react-native-google-signin#readme","bugs":{"url":"https://github.com/Dulcet-Labs/react-native-google-signin/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"peerDependencies":{"react":">=17.0.0","react-native":">=0.65.0"},"scripts":{"test":"jest","test:watch":"jest --watch","typecheck":"tsc --noEmit","prepublishOnly":"tsc"},"jest":{"transform":{"^.+\\.tsx?$":"@swc/jest"},"testEnvironment":"node","roots":["<rootDir>/src"],"testMatch":["**/__tests__/**/*.test.ts"],"moduleNameMapper":{"^react-native$":"<rootDir>/src/__mocks__/react-native.ts"}},"devDependencies":{"@swc/core":"^1.15.47","@swc/jest":"^0.2.39","@types/jest":"^30.0.0","@types/react":"^19.2.18","@types/react-native":"^0.72.8","jest":"^30.4.2","react":"^18.0.0","react-native":"^0.86.2","ts-jest":"^29.4.12","typescript":"^7.0.2"},"_id":"@dulcetlabs/react-native-google-signin@1.0.1","gitHead":"b9e8cc3eaf8dd4ec540e6ac3cba17af816b7f699","_nodeVersion":"22.17.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-/JEFZud6BWrhv1ZaIoDmi9UBpSfRSzArXl8tGontsdF4ENuow5ZKSSfKzF7HAD1rN188V9q6U3nnMrP7gWKeIA==","shasum":"3d36b15834cec88ff68d6ea165fe8feaf4b0f1b4","tarball":"https://registry.npmjs.org/@dulcetlabs/react-native-google-signin/-/react-native-google-signin-1.0.1.tgz","fileCount":37,"unpackedSize":198766,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCHIML9VApBLI8shOGEP++P8FNIgUfkhkjqD6ZEEkm/7wIhANpzTbAM0KCqnwaFPYy9xTs89H0QeNY527yziXisq/2J"}]},"_npmUser":{"name":"nicksol","email":"soldulcetlabs@gmail.com"},"directories":{},"maintainers":[{"name":"nicksol","email":"soldulcetlabs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-google-signin_1.0.1_1785748145118_0.012549549557493211"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T08:51:42.587Z","modified":"2026-08-03T09:09:05.454Z","1.0.0":"2026-08-03T08:51:42.885Z","1.0.1":"2026-08-03T09:09:05.276Z"},"bugs":{"url":"https://github.com/Dulcet-Labs/react-native-google-signin/issues"},"author":{"name":"Dulcet Labs"},"license":"MIT","homepage":"https://github.com/Dulcet-Labs/react-native-google-signin#readme","keywords":["react-native","google-signin","google-sign-in","google-login","credential-manager","sign-in-with-google","auth","authentication","oauth","oauth2","openid-connect","android"],"repository":{"type":"git","url":"git+https://github.com/Dulcet-Labs/react-native-google-signin.git"},"description":"A premium, Google-compliant Sign-In library for React Native. Dual-flow support — modern Credential Manager + classic GoogleSignInClient. Built directly on Google's official SDKs with no hacks.","maintainers":[{"name":"nicksol","email":"soldulcetlabs@gmail.com"}],"readme":"# Dulcet Google Sign-In\n\nSeamless Google Sign-In — built on Google's Credential Manager and OAuth 2.0. No hacks, no shortcuts, just their official APIs done right.\n\n**Currently shipping: React Native Android** — iOS, Flutter, Web, and native coming next.\n\n---\n\n## 🚀 Quick Start\n\n### 1. Set up local modules\n\nCopy the library into your app:\n\n```bash\ncp -r AuthSignIn/src your-app/local_modules/@dulcet/react-native-google-signin/\ncp -r AuthSignIn/android your-app/local_modules/@dulcet/react-native-google-signin/android\n```\n\nCreate `local_modules/@dulcet/react-native-google-signin/package.json`:\n\n```json\n{\n  \"name\": \"@dulcet/react-native-google-signin\",\n  \"main\": \"index.ts\"\n}\n```\n\n### 2. Metro config\n\nIn `metro.config.js`:\n\n```js\nconst path = require('path');\n\nconst config = {\n  resolver: {\n    extraNodeModules: {\n      '@dulcet/react-native-google-signin': path.resolve(\n        __dirname, 'local_modules/@dulcet/react-native-google-signin'\n      ),\n    },\n  },\n};\n\nmodule.exports = mergeConfig(getDefaultConfig(__dirname), config);\n```\n\n### 3. Android setup\n\n**`android/settings.gradle`** — add:\n\n```gradle\ninclude ':react-native-google-signin'\nproject(':react-native-google-signin').projectDir =\n    new File(rootProject.projectDir, '../local_modules/@dulcet/react-native-google-signin/android')\n```\n\n**`android/app/build.gradle`** — add to `dependencies`:\n\n```gradle\nimplementation project(':react-native-google-signin')\n```\n\n**`MainApplication.kt`** (or `.java`) — register the package:\n\n```kotlin\nimport com.dulcelt.googlesignin.RNGoogleSigninPackage\n\n// Inside getReactHost() or getPackages():\nPackageList(this).packages.apply {\n    add(RNGoogleSigninPackage())\n}\n```\n\n### 4. Google Cloud Console\n\n1. **OAuth consent screen** → External → add your email as test user\n2. **Create credentials** → OAuth client ID → **Web application** → copy the Client ID\n3. **Create credentials** → OAuth client ID → **Android** → paste your SHA-1 + package name\n\nGet your SHA-1:\n\n```bash\ncd android && ./gradlew signingReport | grep SHA1\n```\n\n### 5. Use it\n\n```typescript\nimport { GoogleSignin } from '@dulcet/react-native-google-signin';\n\n// Configure once at app startup\nawait GoogleSignin.configure({\n  webClientId: 'YOUR_CLIENT_ID.apps.googleusercontent.com',\n});\n\n// Sign in\nconst { user, idToken } = await GoogleSignin.signIn();\nconsole.log(user.email, user.name);\n\n// Send the idToken to your backend for verification\nawait fetch('/api/auth/google', {\n  body: JSON.stringify({ idToken }),\n});\n\n// Sign out\nawait GoogleSignin.signOut();\n```\n\n---\n\n## 🎛️ Sign-In Flow: Classic vs Modern\n\nYou choose how Google Sign-In looks and feels:\n\n```typescript\n// MODERN (default) — Credential Manager bottom-sheet\n// Clean, Google-recommended, works on API 34+\nGoogleSignin.configure({ webClientId: '...' });\n\n// CLASSIC — tried-and-tested GoogleSignInClient\n// Works on all API levels, maximum stability\nGoogleSignin.configure({ webClientId: '...', useClassicFlow: true });\n```\n\n| Flow | UI | API Support | Stability |\n|---|---|---|---|\n| Modern (default) | Bottom-sheet picker | API 34+ (falls back to classic on older) | ✅ |\n| Classic (`useClassicFlow: true`) | Full-screen activity | All API levels | ✅✅ |\n\n---\n\n## 📖 Full API\n\n### `configure(params)`\n\nCall once, early. **Must** be called before any other method.\n\n```typescript\nawait GoogleSignin.configure({\n  webClientId: string,       // ✅ Required — OAuth Web Client ID\n  useClassicFlow?: boolean,  // false = modern (default), true = classic\n  scopes?: string[],         // Additional Google API scopes\n  offlineAccess?: boolean,   // Server auth code for backend exchange\n  hostedDomain?: string,     // Restrict to Google Workspace domain\n  loginHint?: string,        // Pre-select account (email or Google ID)\n});\n```\n\n### `signIn()`\n\nOpens the Google sign-in UI. Returns:\n\n```typescript\nconst result = await GoogleSignin.signIn();\n\n// result.user\nresult.user.id            // string — Google account ID\nresult.user.name          // string | null — Full name\nresult.user.givenName     // string | null — First name\nresult.user.familyName    // string | null — Last name\nresult.user.email         // string — Email address\nresult.user.photo         // string | null — Profile picture URL\n\n// result tokens + claims\nresult.idToken            // string | null — JWT for backend verification\nresult.idTokenClaims      // object | null — Decoded JWT claims (sub, email, name, picture...)\nresult.accessToken        // string | null — OAuth token for calling Google APIs\nresult.serverAuthCode     // string | null — One-time code for backend exchange\nresult.scopes             // string[] — Scopes requested\nresult.grantedScopes      // string[] — Scopes user actually granted\n```\n\n### `signOut()`\n\nClears the current session. Returns `null`.\n\n```typescript\nawait GoogleSignin.signOut();\n```\n\n### `getCurrentUser()`\n\nSilently checks for a signed-in user. No UI shown.\n\n```typescript\nconst user = await GoogleSignin.getCurrentUser();\n// → GoogleSigninUser | null\n```\n\n### `getTokens()`\n\nReturns current tokens.\n\n```typescript\nconst { idToken, accessToken, idTokenClaims } = await GoogleSignin.getTokens();\n```\n\n### `isSignedIn()`\n\nQuick boolean check.\n\n```typescript\nconst signedIn = await GoogleSignin.isSignedIn(); // → boolean\n```\n\n### `hasPlayServices()`\n\nAndroid only. Check device compatibility.\n\n```typescript\nconst ps = await GoogleSignin.hasPlayServices();\n// → { isAvailable: boolean, statusCode: number, isUserResolvable: boolean, error: string | null }\n```\n\n### `verify()`\n\nFull diagnostic — checks Play Services, SHA-1, configuration, internet, everything.\n\n```typescript\nconst diag = await GoogleSignin.verify();\n// → { healthy: boolean, checks: Array<{ name, status, message, detail? }> }\n```\n\nCall **after** `configure()` for accurate results.\n\n### `revokeAccess()`\n\nFully disconnects the app. User must re-consent next time.\n\n```typescript\nawait GoogleSignin.revokeAccess();\n```\n\n---\n\n## ❌ Error Handling\n\nEvery method throws a `GoogleSigninError`:\n\n```typescript\nimport { GoogleSigninError } from '@dulcet/react-native-google-signin';\n\ntry {\n  await GoogleSignin.signIn();\n} catch (err) {\n  if (err instanceof GoogleSigninError) {\n    console.log(err.code, err.message);\n  }\n}\n```\n\n| Code | Meaning | What to do |\n|---|---|---|\n| `SIGN_IN_CANCELLED` | User dismissed the sign-in | Normal — they can try again |\n| `IN_PROGRESS` | Another sign-in already running | Wait for it |\n| `PLAY_SERVICES_NOT_AVAILABLE` | Google Play Services missing | Update on device |\n| `NO_SAVED_CREDENTIAL` | No saved Google account | Add account in device Settings |\n| `SIGN_IN_REQUIRED` | User must re-authenticate | Call `signIn()` |\n| `NETWORK_ERROR` | No internet | Check connection |\n| `NOT_CONFIGURED` | Forgot `configure()` | Call `configure()` first |\n| `DEVELOPER_ERROR` | Bad Cloud Console config | Check webClientId + SHA-1 |\n| `UNKNOWN_ERROR` | Something unexpected | Read the error message |\n\n---\n\n## 🐛 Debugging\n\n```typescript\n// 1. Run diagnostics\nconst diag = await GoogleSignin.verify();\nconsole.log(JSON.stringify(diag, null, 2));\n\n// 2. Check each check\ndiag.checks.forEach(c => console.log(`[${c.status}] ${c.name}: ${c.message}`));\n```\n\n### Common issues\n\n| Symptom | Fix |\n|---|---|\n| White screen on launch | Check Metro is running, port forwarded |\n| `NOT_CONFIGURED` | Call `configure()` before other methods |\n| `DEVELOPER_ERROR` | Wrong webClientId or SHA-1 not registered in Cloud Console |\n| `healthy: false` in verify | Call `verify()` **after** `configure()` |\n| Sign-in sheet opens then closes | Add a Google account on the device first |\n| App crashes on sign-in | Try `useClassicFlow: true` |\n\n---\n\n## 🗺️ Roadmap\n\n- [x] React Native Android — classic + modern flow\n- [ ] React Native iOS\n- [ ] Flutter Android\n- [ ] Flutter iOS\n- [ ] Native Android (Kotlin)\n- [ ] Web\n","readmeFilename":"README.md"}