---
title: "Python SDK: OAuth"
description: "The methods of the Python client under OAuth. Authorization, token exchange and discovery for scoped third-party apps."
url: https://doorman.fyi/docs/python/reference/oauth
markdown: https://doorman.fyi/docs/python/reference/oauth.md
area: "SDKs and tools"
section: "Python SDK"
---

# Python SDK: OAuth

The methods of the Python client under OAuth. Authorization, token exchange and discovery for scoped third-party apps.

Source: https://doorman.fyi/docs/python/reference/oauth

## client.oauth.authorize

Python:
```python
client.oauth.authorize(*, response_type: Literal['code'], client_id: str, redirect_uri: str, resource: str, scope: str | None = None, state: str | None = None, code_challenge: str, code_challenge_method: Literal['S256']) -> str
```

Operation [`oauth.authorize`](https://doorman.fyi/docs/reference/oauth.md#oauth-authorize): `GET /oauth/authorize`

Begin app authorization.

Access `public`: no credential.

## client.oauth.mcp_resource

Python:
```python
client.oauth.mcp_resource() -> models.OAuthResourceMetadata
```

Operation [`oauth.mcpResource`](https://doorman.fyi/docs/reference/oauth.md#oauth-mcpResource): `GET /.well-known/oauth-protected-resource/mcp`

Discover the MCP resource.

Access `public`: no credential.

## client.oauth.metadata

Python:
```python
client.oauth.metadata() -> models.OAuthServerMetadata
```

Operation [`oauth.metadata`](https://doorman.fyi/docs/reference/oauth.md#oauth-metadata): `GET /.well-known/oauth-authorization-server`

Discover authorization.

Access `public`: no credential.

## client.oauth.register

Python:
```python
client.oauth.register(body: models.RegisterOAuthClient) -> models.RegisteredOAuthClient
```

Operation [`oauth.register`](https://doorman.fyi/docs/reference/oauth.md#oauth-register): `POST /oauth/register`

Register a public client dynamically.

Access `public`: no credential.

## client.oauth.resource

Python:
```python
client.oauth.resource() -> models.OAuthResourceMetadata
```

Operation [`oauth.resource`](https://doorman.fyi/docs/reference/oauth.md#oauth-resource): `GET /.well-known/oauth-protected-resource`

Discover the API resource.

Access `public`: no credential.

## client.oauth.token

Python:
```python
client.oauth.token(body: models.OAuthTokenRequest) -> models.OAuthTokens
```

Operation [`oauth.token`](https://doorman.fyi/docs/reference/oauth.md#oauth-token): `POST /oauth/token`

Exchange or refresh tokens.

Access `public`: no credential.
