Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MomenSherif/react-oauth/llms.txt
Use this file to discover all available pages before exploring further.
@react-oauth/google is a React library that wraps Google’s Google Identity Services (GIS) SDK, giving you production-ready components and hooks for authenticating users with Google in any React application.
Why use this library?
Google deprecated the older Google Sign-In JavaScript Platform Library (platform.js) in favor of the new Google Identity Services SDK. The new SDK has a different API surface — @react-oauth/google wraps it so you don’t have to deal with the low-level GIS API directly.
Key differences from the old react-google-login package:
Old (react-google-login) | New (@react-oauth/google) | |
|---|---|---|
| Underlying SDK | platform.js (deprecated) | Google Identity Services |
| Sign-in model | Persistent session | Credential/token per flow |
| One-tap support | No | Yes |
| Authorization code flow | No | Yes |
| FedCM support | No | Yes |
| Maintenance status | Unmaintained | Active |
Key features
Sign In With Google
Render Google’s official sign-in button with full customization: size, shape, theme, text, and locale. Renders through the GIS SDK for compliance.
One-tap & automatic sign-in
Prompt returning users with a One-tap overlay or sign them in automatically when they revisit. Enable with a single prop.
Custom button flows
Use
useGoogleLogin to trigger implicit or authorization code flows from any UI element you build yourself.Authorization code flow
Initiate the server-side auth code flow for backend token exchange, with full support for redirect and popup UX modes.
TypeScript first
Every component, hook, and callback is fully typed. Types for
CredentialResponse, TokenResponse, CodeResponse, and more are all exported.Automatic SDK loading
Wrap your app with
GoogleOAuthProvider and the Google Identity Services script is loaded automatically — no manual <script> tag required.How it works
GoogleOAuthProvider loads the GIS SDK script (https://accounts.google.com/gsi/client) automatically when it mounts. All child components and hooks read the clientId and script-loaded status from React context, so you only configure your client ID once.
You do not need to add the Google Identity Services script tag to your HTML.
GoogleOAuthProvider handles this for you via the useLoadGsiScript hook internally.Exported API
| Export | Type | Description |
|---|---|---|
GoogleOAuthProvider | Component | Context provider. Loads the GIS SDK and supplies clientId to all children. |
GoogleLogin | Component | Renders the official Sign In With Google button. Supports One-tap via useOneTap prop. |
useGoogleLogin | Hook | Returns a login trigger function for implicit or authorization code flows. |
useGoogleOneTapLogin | Hook | Triggers the One-tap prompt imperatively from any component. |
googleLogout | Function | Revokes the session with Google Identity Services. |
hasGrantedAllScopesGoogle | Function | Checks whether all requested scopes were granted in a token response. |
hasGrantedAnyScopeGoogle | Function | Checks whether at least one requested scope was granted in a token response. |
useGoogleOAuth | Hook | Access clientId and scriptLoadedSuccessfully from context. |
Installation
react-dom 16.8 or later.
Next steps
Quickstart
Add Google sign-in to your React app in minutes with a step-by-step guide.
API reference
Full props and type definitions for every component and hook.

