AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Capacitor Google Auth

skill-sukibk-capacitor-google-auth-skill-capacitor-google-auth-skill · by sukibk

Implement native Google Sign-In for Capacitor mobile apps. Use this skill whenever the user needs Google authentication in a Capacitor app, is dealing with OAuth issues in a WebView or WKWebView, gets a "disallowed_useragent" error from Google, or is building a hybrid mobile app that needs Google login on iOS or Android. Also use when the user mentions @capgo/capacitor-social-login, signInWithIdT…

No reviews yet
0 installs
34 views
0.0% view→install

Install

$ agentstack add skill-sukibk-capacitor-google-auth-skill-capacitor-google-auth-skill

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-sukibk-capacitor-google-auth-skill-capacitor-google-auth-skill)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
6mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Capacitor Google Auth? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Native Google Auth in Capacitor Apps

Why this skill exists

Google blocks OAuth redirect flows inside WKWebView (which Capacitor uses). If you try the standard web OAuth flow in a native Capacitor app, Google returns a disallowed_useragent error. No amount of user-agent spoofing or workarounds fixes this — Google uses JS-based detection too.

The solution is a platform-aware split: use the native Google Sign-In SDK on mobile to get an ID token, then exchange that token with your backend (Supabase, Firebase, custom server, etc.) via token-based auth like signInWithIdToken().

Architecture

Web:    User → Supabase/backend OAuth redirect → callback → session
Native: User → Native Google SDK → ID token → backend signInWithIdToken() → session

The key insight: on native, you never go through a browser redirect. The native SDK presents Google's own sign-in UI, returns an ID token directly, and your backend validates that token to create a session.

Plugin

Use @capgo/capacitor-social-login — this is the actively maintained plugin. Do NOT use the archived @codetrix-studio/capacitor-google-auth.

The plugin's major version tracks Capacitor's major version (Capacitor 7 → plugin v7.x, Capacitor 8 → plugin v8.x). Always match the project's Capacitor version.

Implementation steps

  1. Scan the project — understand the current auth setup, framework (Next.js, React, Vue, etc.), Capacitor version, and whether Google OAuth already works on web
  2. Install the pluginnpm install @capgo/capacitor-social-login with the correct major version
  3. Initialize the plugin at app startup with both web and iOS client IDs
  4. Implement platform-aware sign-in — detect native vs web at runtime and branch:
  • Native: use SocialLogin.login() → get ID token → exchange with backend
  • Web: use standard OAuth redirect flow
  1. Guide the user through manual config they must do themselves:
  • Google Cloud Console: create an iOS OAuth Client ID (Bundle ID must match Xcode project)
  • Backend dashboard (Supabase/Firebase): register the iOS client ID + enable "Skip nonce checks" if using Supabase
  • iOS Info.plist: add reversed iOS client ID as a URL scheme
  • Environment variables for both client IDs
  1. Sync native projects — run npx cap sync ios and npx cap sync android

For detailed code examples, config values, type gotchas, and a list of approaches that don't work, see [references/implementation.md](references/implementation.md).

Critical type gotcha

GoogleLoginResponse from the plugin is a union type — idToken only exists on the Online variant. Always narrow before accessing:

if (!result || !('idToken' in result) || !result.idToken) {
  throw new Error('No ID token from Google')
}

Dead ends (don't waste time on these)

  • OAuth redirect in WKWebView → disallowed_useragent
  • User-agent spoofing → Google uses JS detection too
  • SFSafariViewController via @capacitor/browser → can't present with custom SceneDelegate, redirect back via custom URL scheme is unreliable
  • window.location.href to external OAuth URL → opens Safari but return to app is flaky

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.