{"id":18701,"library":"ra-auth-google","title":"ra-auth-google","description":"An auth provider for react-admin v5+ that integrates Google Identity Services (GIS) for sign-in with Google, One Tap, and automatic sign-in. Current stable version is 3.0.0, released November 2024, with monthly updates. Simplifies authentication by providing an authProvider, LoginButton, OneTapButton, and httpClient. Key differentiators: tightly coupled with react-admin, supports client-side GIS features only, and removes the previous useGoogleAuthProvider/GoogleAuthContext in v3.0.0.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/marmelab/ra-auth-google","tags":["javascript","typescript"],"install":[{"cmd":"npm install ra-auth-google","lang":"bash","label":"npm"},{"cmd":"yarn add ra-auth-google","lang":"bash","label":"yarn"},{"cmd":"pnpm add ra-auth-google","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for react-admin Admin component integration","package":"react-admin","optional":false},{"reason":"Required for React components like LoginButton and OneTapButton","package":"react","optional":false}],"imports":[{"note":"Default import not available; named import only.","wrong":"import googleAuthProvider from 'ra-auth-google'","symbol":"googleAuthProvider","correct":"import { googleAuthProvider } from 'ra-auth-google'"},{"note":"ESM-only package; use named import.","wrong":"const { googleHttpClient } = require('ra-auth-google')","symbol":"googleHttpClient","correct":"import { googleHttpClient } from 'ra-auth-google'"},{"note":"Named export for the Sign in with Google button component.","wrong":null,"symbol":"LoginButton","correct":"import { LoginButton } from 'ra-auth-google'"},{"note":"Named export for the One Tap component.","wrong":null,"symbol":"OneTapButton","correct":"import { OneTapButton } from 'ra-auth-google'"}],"quickstart":{"code":"import { Admin, Resource, Login } from 'react-admin';\nimport { googleAuthProvider, googleHttpClient, LoginButton } from 'ra-auth-google';\n\nconst authProvider = googleAuthProvider({\n    clientId: process.env.VITE_GOOGLE_CLIENT_ID ?? '',\n});\n\nconst httpClient = googleHttpClient({\n    clientId: process.env.VITE_GOOGLE_CLIENT_ID ?? '',\n});\n\nconst App = () => (\n    <Admin authProvider={authProvider} loginPage={LoginButton}>\n        <Resource name=\"posts\" />\n    </Admin>\n);\n\nexport default App;","lang":"typescript","description":"Minimal setup: configure googleAuthProvider and googleHttpClient with client ID, and use LoginButton as login page."},"warnings":[{"fix":"Replace `useGoogleAuthProvider()` with `googleAuthProvider({clientId})` directly.","message":"v3.0.0 removed `useGoogleAuthProvider` and `GoogleAuthContext` – use `googleAuthProvider` directly instead.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Call as function: `googleAuthProvider({clientId})` instead of `new GoogleAuthProvider(config)`.","message":"v3.0.0 made `googleAuthProvider` and `googleHttpClient` callable without parameters – old pattern `new GoogleAuthProvider(config)` breaks.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Upgrade react-admin to v5 or later.","message":"v2.0.0 upgraded `react-admin` peer dependency to v5 – incompatible with v4.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure TypeScript usage; prop-types no longer needed.","message":"v1.0.0 used prop-types, removed in v2.0.0 – not a concern for TypeScript users.","severity":"deprecated","affected_versions":"1.0.0"},{"fix":"Add `<script async defer src=\"https://accounts.google.com/gsi/client\"></script>` to your HTML `<head>`.","message":"Google Identity Services script must be loaded in index.html for GIS to work.","severity":"gotcha","affected_versions":"*"},{"fix":"Use `VITE_GOOGLE_CLIENT_ID` instead of `GOOGLE_CLIENT_ID`.","message":"In development, VITE_GOOGLE_CLIENT_ID env var must have the `VITE_` prefix to be exposed client-side.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Import and use `googleAuthProvider` from 'ra-auth-google' directly.","cause":"Upgraded to v3.0.0 where useGoogleAuthProvider was removed.","error":"Error: useGoogleAuthProvider is not a function"},{"fix":"Run `npm install ra-auth-google --save` and ensure react-admin v5+ is installed.","cause":"Package not installed or conflicting react-admin version.","error":"Module not found: Error: Can't resolve 'ra-auth-google'"},{"fix":"Set `VITE_GOOGLE_CLIENT_ID` in .env or pass clientId explicitly.","cause":"Missing or undefined clientId when calling googleAuthProvider.","error":"GoogleIdentity: 'client_id' is required"},{"fix":"Add `<script async defer src=\"https://accounts.google.com/gsi/client\"></script>` to index.html.","cause":"Google Identity Services script not loaded before React renders.","error":"Error: Cannot read properties of undefined (reading 'google')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}