# Google OAuth ID Token

> Google OAuth2 ID token claims with email, name, picture, and verification.

- Name: `google-oauth-id-token`
- Categories: google
- Detail page: https://open-types.dev/types/google-oauth-id-token

## Install

```bash
# Types only
npx shadcn add @open-types/google-oauth-id-token

# Types + Zod v4 validators
npx shadcn add @open-types/google-oauth-id-token-zod

# Types + real-world examples
npx shadcn add @open-types/google-oauth-id-token-examples
```

## Types

```typescript
export interface GoogleOAuthIdToken {
  iss: string;
  azp: string;
  aud: string;
  sub: string;
  email?: string;
  email_verified?: boolean;
  name?: string;
  picture?: string;
  given_name?: string;
  family_name?: string;
  locale?: string;
  iat: number;
  exp: number;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { GoogleOAuthIdToken } from "../types/google-oauth-id-token";

export const googleOAuthIdTokenSchema = z.object({
  iss: z.string().min(1, { error: "Issuer is required" }),
  azp: z.string().min(1, { error: "Authorized party is required" }),
  aud: z.string().min(1, { error: "Audience is required" }),
  sub: z.string().min(1, { error: "Subject is required" }),
  email: z.email({ error: "Email must be a valid email address" }).optional(),
  email_verified: z.boolean().optional(),
  name: z.string().optional(),
  picture: z.url({ error: "Picture must be a valid URL" }).optional(),
  given_name: z.string().optional(),
  family_name: z.string().optional(),
  locale: z.string().optional(),
  iat: z.number().int({ error: "Issued at must be a whole number" }),
  exp: z.number().int({ error: "Expiration must be a whole number" }),
}) satisfies z.ZodType<GoogleOAuthIdToken>;

export type { GoogleOAuthIdToken } from "../types/google-oauth-id-token";
```

## Examples

```typescript
// Source: https://developers.google.com/identity/openid-connect/openid-connect#an-id-tokens-payload
// Captured: 2026-05
import type { GoogleOAuthIdToken } from "../types/google-oauth-id-token";

const fullProfile = {
  iss: "https://accounts.google.com",
  azp: "1234567890-abcdefghijklmnopqrstuvwxyz12345.apps.googleusercontent.com",
  aud: "1234567890-abcdefghijklmnopqrstuvwxyz12345.apps.googleusercontent.com",
  sub: "104564094328765432109",
  email: "jenny.rosen@example.com",
  email_verified: true,
  name: "Jenny Rosen",
  picture: "https://lh3.googleusercontent.com/a/avatar-jenny",
  given_name: "Jenny",
  family_name: "Rosen",
  locale: "en",
  iat: 1712948400,
  exp: 1712952000,
} as const satisfies GoogleOAuthIdToken;

export const googleOAuthIdTokenExamples = {
  fullProfile,
  noProfileScopes: {
    iss: "https://accounts.google.com",
    azp: fullProfile.azp,
    aud: fullProfile.aud,
    sub: fullProfile.sub,
    iat: fullProfile.iat,
    exp: fullProfile.exp,
  } satisfies GoogleOAuthIdToken,
  emailOnly: {
    iss: "https://accounts.google.com",
    azp: fullProfile.azp,
    aud: fullProfile.aud,
    sub: fullProfile.sub,
    email: "user@example.com",
    email_verified: true,
    iat: fullProfile.iat,
    exp: fullProfile.exp,
  } satisfies GoogleOAuthIdToken,
  unverifiedEmail: {
    ...fullProfile,
    sub: "104564094328765432110",
    email: "unverified@example.com",
    email_verified: false,
  } satisfies GoogleOAuthIdToken,
  hostedDomain: {
    ...fullProfile,
    sub: "104564094328765432111",
    email: "engineer@company.com",
    locale: "en-GB",
  } satisfies GoogleOAuthIdToken,
} as const;
```
