Plugins

Google

Official plugin — Google sign-in via OIDC discovery and JWKS-verified ID tokens.

Google is the reference OIDC provider for oauth(): discovery, ID-token signature checks, and issuer pinning all work the textbook way. If you are wiring your first social provider, start here.

The one rule

Register https://app.example.com/auth/oauth/callback/google (your exact origin) as an Authorized Redirect URI, then enable it with providers.google.enabled. The comparison is byte-exact.

Quick start

Create OAuth credentials

In Google Cloud Console → APIs & Services → Credentials, create an OAuth client ID of type Web application. Add your callback URI under Authorized Redirect URIs.

Plug it

src/app.ts
import { oke } from "okengine";
import { oauth } from "okengine/plugins";

export const app = oke({
  name: "shop",
  env: "dev",
  gate: { auth: {} },
}).plug(
  oauth({
    baseUrl: "https://app.example.com",
    providers: {
      google: { enabled: true },
    },
  }),
);

Set the client secret

# .env.local
OAUTH_GOOGLE_CLIENT_SECRET=GOCSPX-...

Boot fails loudly if the secret is missing — the contract is declared by the plugin itself.

How identity works

The driver discovers Google's endpoints from https://accounts.google.com/.well-known/openid-configuration and caches them. On callback it verifies the ID token end-to-end:

CheckRule
SignatureRS256 / ES256 against Google's published JWKS
Issuermust equal https://accounts.google.com
Audiencemust include your client id (azp when multi-audience)
Expiryrejected when stale
Noncesingle-use, bound to the flow row

Email trust follows the OIDC claim: email_verified: true marks the address verified; anything else — including string "false" — stays unverified.

Default scopes: openid, email, profile.

Options

OptionTypeDefaultMeaning
enabledbooleanfalseTurn the provider on
clientIdstringVault/env*\*OAUTH_GOOGLE_CLIENT_ID
redirectUristring{baseUrl}…/googleExact registered URI
scopesstring[]driver defaultsExtra scopes
storeProviderTokensbooleanfalseKeep tokens in Vault

Surfaces

FlowPath
StartPOST /auth/oauth/google/start
CallbackGET+POST /auth/oauth/callback/google
LinkPOST /auth/oauth/google/link

Troubleshooting

Learn more

  • OAuth — shared flows and security model
  • Vault — where secrets live
  • Gategate.auth

Next

On this page