> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sontairo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth Setup

> Configure OAuth credentials for connector integrations

Most connectors use OAuth 2.0 for secure authentication. This guide explains how to configure OAuth for self-hosted deployments.

## How It Works

1. When a user clicks "Add Connector" and selects an OAuth-based service, Sontairo redirects them to the service's authorization page
2. The user grants permissions
3. The service redirects back to Sontairo with an authorization code
4. Sontairo exchanges the code for access and refresh tokens
5. Tokens are stored encrypted and refreshed automatically

## Platform OAuth Apps (Cloud)

On Sontairo Cloud, OAuth apps are pre-configured for supported services. No setup is required.

## Self-Hosted OAuth Configuration

For self-hosted deployments, you need to register your own OAuth apps with each service.

### Environment Variables

Set the following environment variables for each provider you want to support:

```bash theme={null}
# Google
GOOGLE_OAUTH_CLIENT_ID=your-client-id
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret

# Slack
SLACK_OAUTH_CLIENT_ID=your-client-id
SLACK_OAUTH_CLIENT_SECRET=your-client-secret

# GitHub
GITHUB_OAUTH_CLIENT_ID=your-client-id
GITHUB_OAUTH_CLIENT_SECRET=your-client-secret

# Notion
NOTION_OAUTH_CLIENT_ID=your-client-id
NOTION_OAUTH_CLIENT_SECRET=your-client-secret
```

### Redirect URI

Set your redirect URI to:

```
https://your-domain.com/api/oauth/callback
```

Register this redirect URI in each service's OAuth app settings.

<Info>
  The callback URL is the same for all providers. Sontairo uses the `state` parameter to route callbacks to the correct connector.
</Info>
