# applyDiscoveryDocument

**Kind:** Function

**Source:** [`atloria-monorepo/packages/ui-core/src/components/api-explorer/oauth2.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/packages/ui-core/src/components/api-explorer/oauth2.ts#L239)

Fill an `openIdConnect` scheme in from its discovery document.

A provider that advertises `code_challenge_methods_supported` WITHOUT `S256` is refused: PKCE
is the only thing standing between a public client and a stolen authorization code, and
`plain` does not provide it. A provider that advertises nothing is taken at its word — the
field is optional, and every current provider that omits it supports S256.

## Signature

```ts
function applyDiscoveryDocument(scheme: OAuth2Scheme, doc: DiscoveryDocument): OAuth2Scheme
```

## Parameters

| Name | Type |
|---|---|
| `scheme` | `OAuth2Scheme` |
| `doc` | `DiscoveryDocument` |

**Returns:** `OAuth2Scheme`
