# `OidcClaims`

Who an identity provider says signed in.

Use what your sign-in gets after a person signs in through a provider such as Google. `sub` identifies them for good, and `email` can change. For a token's general claims, use [`JwtClaims`](/docs/types/type-jwt-claims.md).

## Shape

| Field | Type | Required? |
|---|---|---|
| `sub` | `Text` | Yes |
| `name` | `Text` | No |
| `given_name` | [`GivenName`](/docs/types/type-given-name.md) | No |
| `family_name` | [`FamilyName`](/docs/types/type-family-name.md) | No |
| `preferred_username` | `Text` | No |
| `email` | [`Email`](/docs/types/type-email.md) | No |
| `email_verified` | `Bool` | No |
| `phone_number` | [`PhoneNumber`](/docs/types/type-phone-number.md) | No |
| `phone_number_verified` | `Bool` | No |
| `picture` | [`Url`](/docs/types/type-url.md) | No |

Write every field when you build one, and give a field that isn't required as `none`.

## Example

```jadpo
OidcClaims {
    sub: "248289761001"
    name: "Jane Doe"
    given_name: none
    family_name: none
    preferred_username: none
    email: none
    email_verified: none
    phone_number: none
    phone_number_verified: none
    picture: none
}
```

## Good to know

- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it, so sort by one of its parts instead.

## In JSON

An object of its parts, in a request, a response or `json.write`:

```json
{"sub":"248289761001","name":"Jane Doe","given_name":"Jane","family_name":"Doe","preferred_username":"j.doe","email":"janedoe@example.com","email_verified":true,"picture":"https://example.com/janedoe/me.jpg"}
{"sub":"248289761002","email":"j.doe@example.org","email_verified":false}
{"sub":"248289761003"}
```

When you read one, a field that isn't required may be left out, or sent as `null`.

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`OidcClaims` is in the group Security, and has been in Jadpo since 0.1.0.

### Text form

It has no single text form, so `text.from` and `text.parse` don't take it.

### How it is stored

It is stored in 10 columns, each named for the field, `_` and its suffix. This is `{"sub":"248289761002","email":"j.doe@example.org","email_verified":false}`:

| Column | Type | Holds |
|---|---|---|
| `<field>_sub` | `text` | `'248289761002'` |
| `<field>_name` | `text` | `NULL::text` |
| `<field>_given_name` | `text` | `NULL::text` |
| `<field>_family_name` | `text` | `NULL::text` |
| `<field>_preferred_username` | `text` | `NULL::text` |
| `<field>_email` | `text` | `'j.doe@example.org'` |
| `<field>_email_verified` | `boolean` | `FALSE` |
| `<field>_phone_number` | `text` | `NULL::text` |
| `<field>_phone_number_verified` | `boolean` | `NULL::boolean` |
| `<field>_picture` | `text` | `NULL::text` |

### How it is shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `{"sub":"248289761001","name":"Jane Doe","given_name":"Jane","family_name":"Doe","preferred_username":"j.doe","email":"janedoe@example.com","email_verified":true,"picture":"https://example.com/janedoe/me.jpg"}` | `Jane Doe` |
| `{"sub":"248289761002","email":"j.doe@example.org","email_verified":false}` | `j.doe@example.org` |
| `{"sub":"248289761003"}` | `248289761003` |

### Operations

It also takes `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
