Langsung ke konten
Skillpedia
Keamanan22k Β· #10355

sign-in-with-google-web

Fungsinya

Skill ini membantu developer menambahkan tombol Sign In With Google dan login One Tap ke situs web. Skill ini ditujukan untuk tim web yang menginginkan login Google yang aman tanpa membangunnya dari awal.

Kapan dipakai

  • βœ“Saat Anda ingin menambahkan tombol login Google atau login One Tap ke aplikasi web.
  • βœ“Saat Anda perlu memverifikasi ID token Google di backend Anda dengan Python, Node.js, Go, atau Java.
  • βœ“Saat Anda ingin membatasi login hanya untuk domain Google Workspace tertentu.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/google/skills/blob/main/skills/identity/sign-in-with-google-web/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œTambahkan Sign In With Google ke aplikasi React saya dan verifikasi token login di server Node.js saya.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill ini merekomendasikan desain yang dimediasi backend jika memungkinkan, lalu menulis kode Google Identity Services dan pemeriksaan token di sisi server. Skill ini mencakup One Tap, FedCM, dan pembatasan domain.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

Pertanyaan umum

Arsitektur apa yang direkomendasikan?

Pola yang dimediasi backend terlebih dahulu karena paling aman, dengan pola khusus klien sebagai cadangan.

Apakah mencakup framework?

Ya. Skill ini mencakup React, Next.js, Angular, dan HTML biasa.

Apakah memeriksa token di server?

Ya. Skill ini mencakup verifikasi ID token untuk backend Python, Node.js, Go, dan Java.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
22k
Peringkat
#10355
Lisensi
Apache-2.0
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa