# @oauth

## Overview

The `@oauth` decorator is used to apply OAuth-based authentication to classes. It adds OAuth-specific metadata, such as endpoints, arguments, and provider details, to the class, enabling integration with OAuth services.

## Syntax

```python
@oauth(
    id=str,
    provider=OAuthProvider,
    flows=Optional[List[OAuthFlow]] = None,
    authorize_endpoint=str,
    token_endpoint=str,
    scopes=Optional[List[str]] = None,
)
class ClassName:
    """
    Class description
    """
    # Class implementation
```

## Parameters

<table><thead><tr><th width="209.953125">Parameter</th><th width="146.4609375">Type</th><th width="107.3125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>str</td><td>Yes</td><td>The unique identifier for the OAuth configuration.</td></tr><tr><td><code>provider</code></td><td>OAuthProvider</td><td>Yes</td><td><p>The OAuth provider:</p><ul><li>OAuthProvider.MICROSOFT</li><li>OAuthProvider.GOOGLE</li></ul></td></tr><tr><td><code>flows</code></td><td>List[OAuthFlow]</td><td>Optional</td><td>A list of OAuth flows.</td></tr><tr><td><code>authorize_endpoint</code></td><td>str</td><td>Yes</td><td>The authorization endpoint URL for the OAuth provider.</td></tr><tr><td><code>token_endpoint</code></td><td>str</td><td>Yes</td><td>The token endpoint URL for exchanging the authorization code for a token.</td></tr><tr><td><code>scopes</code></td><td>List[str]</td><td>Optional</td><td>A list of scopes required by the OAuth provider for the authenticated requests.</td></tr></tbody></table>

## Example

```python
@oauth(
    id="oauth",
    provider=OAuthProvider.MICROSOFT,
    flows=[OAuthFlow.AUTHORIZATION_CODE],
    authorize_endpoint="https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/authorize",
    token_endpoint="https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token",
    scopes=[
        "https://graph.microsoft.com/Files.ReadWrite",
        "https://graph.microsoft.com/Sites.ReadWrite.All",
    ],
)
@book(name="MicrosoftBook")
class BaseMicrosoftBook
```
