# OAuth

> SDK methods for the OAuth module, accessed via `soat.oauth`. See the [OAuth module docs](/docs/modules/oauth) for permissions and data model, and each method's REST page for the full request/response schema.

# OAuth

SDK methods for the OAuth module, accessed via `soat.oauth`. See the [OAuth module docs](/docs/modules/oauth) for permissions and data model, and each method's REST page for the full request/response schema.

### `soat.oauth.getOauthAuthorizationServerMetadata()`

Get authorization server metadata

- Method: `GET`
- Path: `/.well-known/oauth-authorization-server`

```ts
await soat.oauth.getOauthAuthorizationServerMetadata();
```

→ [Request & response schema](/docs/api/oauth/get-oauth-authorization-server-metadata)

### `soat.oauth.getOauthProtectedResourceMetadata()`

Get protected resource metadata

- Method: `GET`
- Path: `/.well-known/oauth-protected-resource`

```ts
await soat.oauth.getOauthProtectedResourceMetadata();
```

→ [Request & response schema](/docs/api/oauth/get-oauth-protected-resource-metadata)

### `soat.oauth.registerOauthClient()`

Register an OAuth client

- Method: `POST`
- Path: `/register`

```ts
await soat.oauth.registerOauthClient({
  body: { redirect_uris, /* + optional */ },
});
```

→ [Request & response schema](/docs/api/oauth/register-oauth-client)

### `soat.oauth.authorizeOauthClient()`

Start the authorization code flow

- Method: `GET`
- Path: `/authorize`

```ts
await soat.oauth.authorizeOauthClient({
  query: { client_id, redirect_uri, response_type, code_challenge, code_challenge_method, /* + optional */ },
});
```

→ [Request & response schema](/docs/api/oauth/authorize-oauth-client)

### `soat.oauth.createOauthToken()`

Exchange a code or refresh token for an access token

- Method: `POST`
- Path: `/token`

```ts
await soat.oauth.createOauthToken({
  body: { grant_type, /* + optional */ },
});
```

→ [Request & response schema](/docs/api/oauth/create-oauth-token)
