# resolveOAuth2Requirement

**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#L288)

Which OAuth2 scheme — and which scopes — this operation demands.

`security` is an OR of alternatives, each an AND of schemes. We take the first alternative
naming a scheme we can run, which is the one a reader would be steered towards anyway. An
operation declaring no `security` of its own inherits the document default; `security: []`
is explicitly public and inherits nothing.

## Signature

```ts
function resolveOAuth2Requirement(endpointSecurity: Array<Record<string, string[]>> | undefined, documentSecurity: Array<Record<string, string[]>> | undefined, schemes: OAuth2Scheme[]): OAuth2Requirement | null
```

## Parameters

| Name | Type |
|---|---|
| `endpointSecurity` | `Array<Record<string, string[]>> | undefined` |
| `documentSecurity` | `Array<Record<string, string[]>> | undefined` |
| `schemes` | `OAuth2Scheme[]` |

**Returns:** `OAuth2Requirement | null`
