\n
\n\n\n\n\n```\n\nThen on your backend, verify the ID token with Google before creating a session.\n\n---\n\n## Example: Backend token verification\nIf your app has a backend, don’t trust the client alone. Verify the token server-side.\n\n### Node.js example\n```js\nimport { OAuth2Client } from 'google-auth-library';\n\nconst client = new OAuth2Client('YOUR_GOOGLE_CLIENT_ID');\n\nasync function verifyGoogleToken(idToken) {\n const ticket = await client.verifyIdToken({\n idToken,\n audience: 'YOUR_GOOGLE_CLIENT_ID',\n });\n return ticket.getPayload();\n}\n```\n\n---\n\n## Important notes\n- Use the **correct client ID** for your platform\n- Make sure **redirect URIs** match exactly\n- If you request sensitive scopes, Google may require verification\n- If your app uses backend auth, exchange or verify the Google token and then create your own app session/JWT\n\n---\n\n## If you want, I can give you a step-by-step integration guide for:\n- **React web**\n- **Android**\n- **iOS / Swift**\n- **Flutter**\n- **React Native**\n- **Node.js backend**\n\nTell me your platform and I’ll provide the exact code."}}}Prompt
How do I integrate Google sign in with my app?
Latest observation
Oct 6, 2026
OpenAI APIWeb search: off
To integrate Google Sign-In with your app, the exact steps depend on your platform, but the overall flow is usually:
- Create a Google Cloud project
- Configure OAuth consent screen
- Create OAuth credentials
- Add the Google Sign-In SDK / library
- Implement the sign-in flow in your app
- Verify the user on your backend if you have one
General setup
1) Create a project in Google Cloud
- Go to the Google Cloud Console
- Create a new project or select an existing one
2) Configure the OAuth consent screen
- In Google Cloud Console, open APIs & Services → OAuth consent screen
- Choose External if users outside your org will sign in
- Fill in app name, support email, and authorized domains
- Add test users if your app is still in testing
3) Create OAuth client credentials
Under APIs & Services → Credentials:
- Create an OAuth client ID
- Choose the app type:
- Web application
- Android
- iOS
- Add the correct redirect URIs / package names / bundle IDs
4) Add the Google sign-in library
Web
Use Google Identity Services:
<script src="https://accounts.google.com/gsi/client" async defer></script>
Android
Use Google Identity Services / Google Sign-In via Play services depending on your setup:
- Add the Google auth dependency
- Configure your
google-services.json
iOS
- Add the Google Sign-In SDK via Swift Package Manager, CocoaPods, or manual integration
Example: Web sign-in
A basic button flow using Google Identity Services:
<div id="g_id_onload"
data-client_id="YOUR_GOOGLE_CLIENT_ID"
data-callback="handleCredentialResponse">
</div>
<div class="g_id_signin" data-type="standard"></div>
<script>
function handleCredentialResponse(response) {
console.log("ID token:", response.credential);
// Send token to your server for verification
}
</script>
Then on your backend, verify the ID token with Google before creating a session.
Example: Backend token verification
If your app has a backend, don’t trust the client alone. Verify the token server-side.
Node.js example
import { OAuth2Client } from 'google-auth-library';
const client = new OAuth2Client('YOUR_GOOGLE_CLIENT_ID');
async function verifyGoogleToken(idToken) {
const ticket = await client.verifyIdToken({
idToken,
audience: 'YOUR_GOOGLE_CLIENT_ID',
});
return ticket.getPayload();
}
Important notes
- Use the correct client ID for your platform
- Make sure redirect URIs match exactly
- If you request sensitive scopes, Google may require verification
- If your app uses backend auth, exchange or verify the Google token and then create your own app session/JWT
If you want, I can give you a step-by-step integration guide for:
- React web
- Android
- iOS / Swift
- Flutter
- React Native
- Node.js backend
Tell me your platform and I’ll provide the exact code.