---
title: Operator OAuth clients
description: "Configure built-in operator Google, GitHub, and Slack OAuth clients and the optional OAuth client metadata document on self-hosted Executor."
---

Self-hosted operators can pre-register Google and GitHub OAuth applications for fresh member sign-ins — and a Slack OAuth application for reconnecting or renewing existing grants — in environment variables so members do not need to enter their own OAuth client credentials (**Self-host** only; **Cloud** provides managed clients and **Local** users enter their own credentials or use dynamic registration for supporting providers).

Set the matching `EXECUTOR_OAUTH_<PROVIDER>_CLIENT_ID` and `EXECUTOR_OAUTH_<PROVIDER>_CLIENT_SECRET` environment variables and register the provider-account callback URL `<BETTER_AUTH_URL>/api/oauth/callback` (or your `EXECUTOR_OAUTH_CALLBACK_URL`) with each provider.

**Prerequisites:** A running self-host container ([Self-host with Docker](/docs/run/self-host)) with `BETTER_AUTH_URL` set, and developer/admin access to create OAuth apps in Google Cloud Console, GitHub, or Slack.

**You'll know it worked when** the container starts healthy without missing-pair errors in `docker logs`, a compatible app's **Accounts → Connect new account** flow offers **Executor for Google** or **Executor for GitHub**, and completing a connection succeeds with the provider.

## Callback URL

By default, provider-account authorization-code OAuth flows redirect back to:

```text
<BETTER_AUTH_URL>/api/oauth/callback
```

(OIDC SSO uses `/api/auth/callback/sso`, and inbound MCP authorization uses its own routes.) Register that exact URL as the authorized redirect/callback URI in Google, GitHub, and Slack. `EXECUTOR_OAUTH_CALLBACK_URL` changes the advertised provider-account redirect URI without adding a new server path — if you set it, route that URL to Executor's `GET /api/oauth/callback` handler and register it with the provider.

## Built-in operator OAuth clients

Executor defines three built-in operator client slots. Each slot turns on when you supply **both** its client ID and client secret. Setting only one of the pair fails startup.

| Provider | Display label | Environment variables | Managed access-token hosts for app requests |
| --- | --- | --- | --- |
| Google | **Executor for Google** | `EXECUTOR_OAUTH_GOOGLE_CLIENT_ID`, `EXECUTOR_OAUTH_GOOGLE_CLIENT_SECRET` | `*.googleapis.com` |
| GitHub | **Executor for GitHub** | `EXECUTOR_OAUTH_GITHUB_CLIENT_ID`, `EXECUTOR_OAUTH_GITHUB_CLIENT_SECRET` | `api.github.com`, `uploads.github.com`, `api.githubcopilot.com` |
| Slack | **Executor for Slack** | `EXECUTOR_OAUTH_SLACK_CLIENT_ID`, `EXECUTOR_OAUTH_SLACK_CLIENT_SECRET` | `mcp.slack.com` |

Executor places the managed access token in app requests to these hosts only if both the app and the connected account allow the destination (managed OAuth uses separate sealing and its configured header and host limits). OAuth code exchange and token refresh use each provider's token endpoint shown below, which is separate from the app-request host list.

### Google (`Executor for Google`)

1. In Google Cloud Console, create an OAuth 2.0 Web application client and add `<BETTER_AUTH_URL>/api/oauth/callback` as an authorized redirect URI.
2. Enable the Google APIs your apps use and configure the OAuth consent screen for the scopes your apps request.
3. Pass `EXECUTOR_OAUTH_GOOGLE_CLIENT_ID` and `EXECUTOR_OAUTH_GOOGLE_CLIENT_SECRET` to the container.

Executor authorizes at `https://accounts.google.com/o/oauth2/v2/auth` and exchanges or refreshes tokens at `https://oauth2.googleapis.com/token` (`client_secret_post`), requesting offline refresh tokens (`access_type=offline`, `prompt=consent`) with default scopes `openid`, `email`, and `profile`. On self-host, the allowed scope list covers the built-in Google Workspace, Calendar, Meet, Gmail (including `https://mail.google.com/` and `https://www.googleapis.com/auth/gmail.modify`), Sheets, Drive, Docs, Slides, Forms, Tasks, Contacts/People, Photos, Search Console, YouTube, Google Ads, BigQuery, and Apps Script scopes. For app requests, Executor places the managed access token only on `*.googleapis.com` when allowed by the app and account. Executor does not call a provider revocation endpoint when removing an account for this client.

### GitHub (`Executor for GitHub`)

1. Create a GitHub App with User-to-Server OAuth enabled and set its callback URL to `<BETTER_AUTH_URL>/api/oauth/callback`. Configure the repository and account permissions the app needs in GitHub.
2. Pass `EXECUTOR_OAUTH_GITHUB_CLIENT_ID` and `EXECUTOR_OAUTH_GITHUB_CLIENT_SECRET` to the container.

Executor authorizes at `https://github.com/login/oauth/authorize` and exchanges or refreshes tokens at `https://github.com/login/oauth/access_token`. Operator client matching checks the authorization and token endpoints, and because GitHub Apps rely on app-level permissions rather than OAuth scopes (`defaultScopes: []`), **Executor for GitHub** is offered only to providers that declare no OAuth scopes. For app requests, Executor places the managed access token only on `api.github.com`, `uploads.github.com`, and `api.githubcopilot.com` when allowed by the app and account.

### Slack (`Executor for Slack`)

1. Configure your Slack OAuth app with redirect URL `<BETTER_AUTH_URL>/api/oauth/callback`.
2. Pass `EXECUTOR_OAUTH_SLACK_CLIENT_ID` and `EXECUTOR_OAUTH_SLACK_CLIENT_SECRET` to the container.

Executor uses Slack's user-token endpoints (`https://slack.com/oauth/v2_user/authorize` and `https://slack.com/api/oauth.v2.user.access` for code exchange and refresh) with resource `https://mcp.slack.com`, placing the managed access token for app requests only on `mcp.slack.com` when allowed by the app and account. **Executor for Slack** is `unlisted` in beta.79: it does not appear when starting a brand-new account sign-in, and is used only to reconnect or renew existing grants that already use it.

## OAuth client metadata document

Executor can register a client dynamically when a remote provider advertises OAuth Dynamic Client Registration. If an eligible provider (such as many remote MCP servers) advertises Client ID Metadata Documents and you configure `EXECUTOR_OAUTH_CLIENT_METADATA_URL`, Executor can use that metadata URL instead. Existing matching or stored clients remain available.

Set `EXECUTOR_OAUTH_CLIENT_METADATA_URL` to a canonical, publicly reachable `https://` URL. To have Executor serve the document itself on your instance origin, use `/oauth/client-metadata.json`:

```bash
EXECUTOR_OAUTH_CLIENT_METADATA_URL=https://executor.example.com/oauth/client-metadata.json
```

Executor then serves the metadata document at `/oauth/client-metadata.json`, listing a callback URL on that same origin (`EXECUTOR_OAUTH_CALLBACK_URL` if it shares the origin, otherwise `/api/oauth/callback`). You can also host the metadata document externally. Startup validation rejects non-canonical, plain HTTP, loopback, and known private URL literals, but does not verify DNS or public reachability.

Turn this on **only** when the metadata URL is publicly reachable over HTTPS on the internet — remote OAuth servers fetch the metadata document directly.

## Example

Replace the placeholder origin, client IDs, and client secrets below with your own values before starting the container:

```bash
docker run -d --name executor-v2 --init --restart unless-stopped \
  -p 127.0.0.1:4400:4400 -v executor-v2-data:/app/data \
  -e BETTER_AUTH_URL=https://executor.example.com \
  -e EXECUTOR_OAUTH_GOOGLE_CLIENT_ID=1234567890-example.apps.googleusercontent.com \
  -e EXECUTOR_OAUTH_GOOGLE_CLIENT_SECRET=GOCSPX-example-secret \
  -e EXECUTOR_OAUTH_GITHUB_CLIENT_ID=Iv23liExampleClientId \
  -e EXECUTOR_OAUTH_GITHUB_CLIENT_SECRET=example-github-secret \
  -e EXECUTOR_OAUTH_CLIENT_METADATA_URL=https://executor.example.com/oauth/client-metadata.json \
  ghcr.io/usefulsoftwareco/executor-selfhost:2.0.0-beta.79
```

Confirm the container started cleanly and serves the metadata document:

```bash
curl -sf http://127.0.0.1:4400/health
curl -sf http://127.0.0.1:4400/oauth/client-metadata.json
```

Then open a compatible app's **Accounts → Connect new account** flow in the dashboard to confirm it offers the configured operator client, and complete a connection to verify the provider accepts your credentials and callback URI.

## Limits

- Setting a client ID without its matching client secret (or vice versa) fails startup and logs the missing counterpart.
- `EXECUTOR_OAUTH_CLIENT_METADATA_URL` must be a canonical `https://` URL with a path and no query string, fragment, or embedded credentials; startup fails for loopback, private-address literals, plain HTTP URLs, or a different path on your instance's own origin.
- **Executor for GitHub** is offered only to providers that declare no OAuth scopes.
- **Executor for Slack** is `unlisted` and is used only for reconnecting or renewing existing grants, not new account sign-ins.
- For Google, if an app explicitly requires a scope outside the built-in allowed list, the operator client is not used and users must supply their own Google OAuth client (if extra scopes are only advertised during discovery rather than explicitly required, Executor can request the allowed subset).

## Related

- [Self-host with Docker](/docs/run/self-host)
- [Deploy, proxy, and tune self-host](/docs/run/self-host/deploy)
- [Sign-in and OIDC SSO](/docs/run/self-host/sign-in-and-sso)
- [Connect an account](/docs/connect-an-account)
- [Providers and accounts](/docs/concepts/providers-and-accounts)
