# writeGrant

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

Grants follow the reader-key custody model (`readerKey.ts`): docs-origin localStorage, keyed
per project and scheme, clearable, never a cookie. An access token expires on its own; a
refresh token — which would not — is never written here because `normalizeGrant` drops it.

## Signature

```ts
function writeGrant(storage: StorageLike | undefined, namespace: string, grant: OAuth2Grant): void
```

## Parameters

| Name | Type |
|---|---|
| `storage` | `StorageLike | undefined` |
| `namespace` | `string` |
| `grant` | `OAuth2Grant` |

**Returns:** `void`
