Skip to content
Skillpedia
Security22k Β· #10355

sign-in-with-google-web

What it does

This skill helps developers add a Sign In With Google button and One Tap login to websites. It is for web teams who want secure Google login without building it from scratch.

When to use it

  • βœ“When you want to add a Google sign-in button or One Tap login to a web app.
  • βœ“When you need to verify Google ID tokens on your backend in Python, Node.js, Go or Java.
  • βœ“When you want to limit sign-in to a Google Workspace domain.

Skill link

https://github.com/google/skills/blob/main/skills/identity/sign-in-with-google-web/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/google/skills/blob/main/skills/identity/sign-in-with-google-web/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œAdd Sign In With Google to my React app and verify the login token on my Node.js server.”

5 new skills a week. 1 minute to read.

How it works

It recommends a backend-mediated design where possible, then writes the Google Identity Services code and the server-side token check. It covers One Tap, FedCM and domain restrictions.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Sign In With Google (SiwG) Integration & Security Architecture

This skill provides normative architectural guidelines, secure implementation contracts, and failure-prevention protocols for integrating Sign In With Google via the Google Identity Services (GIS) Web SDK (https://accounts.google.com/gsi/client).

1. IETF Architecture Taxonomy & Hierarchy (RECOMMEND BFF / TMB FIRST)

All Sign In With Google implementations MUST align with the IETF OAuth 2.0 for Browser-Based Applications (draft-ietf-oauth-browser-based-apps) taxonomy.

[!IMPORTANT] Primary Recommendation: Always recommend backend-mediated patterns (Pattern A: Backend For Frontend or Pattern B: Token-Mediating Backend / Redirect Mode) as the most secure, robust, and industry-standard architectures whenever an application has a backend server. Fall back to client-only browser patterns (Patterns C & D) only when constrained by serverless static hosting or offline-first PWA requirements.

<!-- mdformat off(reason: preserve ASCII architecture diagram width) -->
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          IETF ARCHITECTURE HIERARCHY & SELECTION                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Pattern A (RECOMMENDED): β”‚ Pattern B (RECOMMENDED): β”‚ Patterns C & D (Fallbacks):       β”‚
β”‚ Backend For Frontend     β”‚ Token-Mediating Backend  β”‚ Browser-Based OAuth Client        β”‚
β”‚ (BFF - IETF Β§ 6.1)       β”‚ (TMB / Redirect Β§ 6.2)   β”‚ (JavaScript-Only - IETF Β§ 6.3)    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ πŸ† GOLD STANDARD         β”‚ πŸš€ NATIVE FORM REDIRECT  β”‚ ⚑ STATIC SPA / πŸ’Ύ OFFLINE PWA    β”‚
β”‚ β€’ Full-stack SPA + API   β”‚ β€’ Server-rendered & apps β”‚ β€’ Pure client-side or offline PWAsβ”‚
β”‚ β€’ Client JS fetch to API β”‚ β€’ GIS HTTP POST login_uriβ”‚ β€’ C: Ephemeral in-memory closure  β”‚
β”‚ β€’ HttpOnly session cookieβ”‚ β€’ Direct server redirect β”‚ β€’ D: WebCrypto Encrypted IndexedDBβ”‚
β”‚ β€’ Tokens never in browserβ”‚ β€’ Tokens never in JS     β”‚ β€’ Strict WebCrypto nonces / keys  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
<!-- mdformat on -->

πŸ† Pattern A: Backend For Frontend (BFF - IETF Β§ 6.1) β€” STRONGLY RECOMMENDED

  • Why it is the Gold Standard: ID tokens (JWTs) and access tokens are never exposed to browser JavaScript across page reloads. This provides complete architectural immunity against XSS token harvesting.

  • Architecture: The browser frontend loads the GIS SDK, captures the credential in JavaScript callback (callback: handleCredentialResponse), and immediately forwards the ID token (JWT) via fetch('/api/auth/google', { method: 'POST' }) to the backend.

  • Backend Responsibilities: The backend validates the JWT cryptographic signature against Google's public JWKs (google.oauth2.id_token.verify_oauth2_token), checks the aud, hd, and nonce claims against server session state, creates a server session, and issues a first-party HttpOnly; Secure; SameSite=Lax session cookie.

  • See full implementation in references/bff_fastapi_verification.md.

πŸš€ Pattern B: Token-Mediating Backend via login_uri Redirect (IETF Β§ 6.2) β€” Server-Rendered & Form POST

  • Why it is Highly Secure: Bypasses client-side JavaScript credential handling entirely by instructing GIS to perform an HTTP POST directly to the backend's login_uri.

  • Architecture: Configured via google.accounts.id.initialize({ client_id, login_uri: "https://example.com/api/auth/callback", ux_mode: "redirect" }) or HTML attributes (data-login_uri="https://example.com/api/auth/callback" and data-ux_mode="redirect").

  • Backend Responsibilities: The backend receives the ID token as a form POST body (credential parameter), validates the double-submit g_csrf_token cookie against the g_csrf_token POST body field, cryptographically verifies the ID token server-side, establishes a session cookie, and returns a standard HTTP 302/303 redirect.

  • See full implementation in references/tmb_login_uri_redirect.md.

Pat

FAQ

Which architecture does it recommend?

Backend-mediated patterns first, since they are the most secure, with client-only patterns as a fallback.

Does it cover frameworks?

Yes. It covers React, Next.js, Angular and plain HTML.

Does it check tokens on the server?

Yes. It covers ID token verification for Python, Node.js, Go and Java backends.

Details

Original description by the author

Implement, configure, and secure Sign In With Google (SiwG) using Google Identity Services (GIS / `https://accounts.google.com/gsi/client`) across web architectures. Use when creating Google sign-in buttons, implementing Google One Tap with FedCM, integrating GIS in React/Next.js/Angular/HTML, verifying ID tokens on backend runtimes (Python/Node.js/Go/Java), enforcing Google Workspace domain restrictions (`hd`), securing client-side ID tokens via WebCrypto nonces or encrypted IndexedDB, embedding in cross-origin iframes via the Intermediate Iframe API (`https://accounts.google.com/gsi/intermed

repo: google/skills

Popularity

GitHub stars
22k
Ranking position
#10355
License
Apache-2.0
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills