# Browser sign-in (OAuth)

Source: [Browser sign-in (OAuth)](<https://docs.gptunnel.ru/en/mcp/oauth/>)

<a id="_top"></a>
Use OAuth to connect Claude, ChatGPT, Cursor, VS Code or Codex through your browser. Once you grant access, the client refreshes it automatically.

> **Tip: OAuth or key?**
>
> Use **OAuth** for interactive clients such as chat apps, editors and terminals. Use an **[MCP key](<https://docs.gptunnel.ru/en/mcp/keys/>)** for server-side agents, CI and shared runners that lack browser access.

 <a id="how-does-it-go"></a>
 
<a id="sign-in-and-grant-access"></a>
## Sign in and grant access

1. Add `https://gptunnel.ru/mcp` to the client without a key. See [client setup](<https://docs.gptunnel.ru/en/mcp/connect/>).
2. The client opens GPTunneL in your browser. Sign in to your account if prompted.
3. The consent screen shows **the app requesting access**, **its requested permissions** and **the spending limits**. GPTunneL highlights permissions that allow the app to spend money.
4. Review the daily spending limit (1,000 RUB by default), set an optional monthly limit and decide whether the app can spend from organization balances. Click **Allow**.
5. The client refreshes access automatically. To reconnect after you revoke access, sign in again.

> **Caution: Unverified application**
>
> The app’s registrant supplies its name and logo. If the consent screen marks the app as unverified, check the address it will redirect to. Click **Allow** only if you just initiated this connection yourself.

<a id="what-rights-are-granted-to-the-application"></a>
## What rights are granted to the application

The consent screen grants the requested permissions as a set. Clients typically ask for all permissions the server offers. To choose individual permissions, issue an [MCP key](<https://docs.gptunnel.ru/en/mcp/keys/>).

| Permission | Allows the app to | Can spend money |
| --- | --- | --- |
| `workflow:read` | Read your workflows and their run status | — |
| `workflow:write` | Create, edit and delete workflows, copy templates and upload files | — |
| `workflow:execute` | Start and cancel runs or retry nodes | Yes |
| `lab:read` | Browse Creative Lab models, get cost estimates and check your generation status | — |
| `lab:generate` | Start image and video generation | Yes |
| `gallery:read` | View your generations and collections | — |
| `gallery:write` | Create, edit and delete collections and move generations between them | — |
| `apps:read` | Browse apps and catalog prices, get cost estimates and check your task status | — |
| `apps:run` | Run apps | Yes |

See the [tool reference](<https://docs.gptunnel.ru/en/mcp/tools/>) for what each permission covers.

<a id="connected-applications"></a>
## Connected applications

Open [your profile](<https://gptunnel.ru/profile/mcp>) and select **MCP → Connected applications** to see which apps you authorized. You can change a connection’s spending limits, review its permissions or revoke access. Revocation takes effect immediately. The client must sign in again before it can reconnect.

> **Note: Separate limit for each application**
>
> GPTunneL applies spending limits independently to each app and each MCP key. See [Billing and limits](<https://docs.gptunnel.ru/en/mcp/billing/>).

<a id="for-client-developers"></a>
## For client developers

The server implements OAuth 2.1 under the MCP authorization specification. It supports PKCE (S256), public clients without a secret, dynamic client registration (RFC 7591) and refresh tokens. Clients discover the configuration from the `WWW-Authenticate` header in the `401` response.

| Endpoint | Purpose |
| --- | --- |
| `GET /.well-known/oauth-protected-resource/mcp` | Protected resource metadata (RFC 9728) |
| `GET /.well-known/oauth-authorization-server` | Authorization server metadata (RFC 8414) |
| `POST /mcp/oauth/register` | Dynamic client registration (RFC 7591) |
| `GET /mcp/oauth/authorize` | Start authorization and open the consent screen |
| `POST /mcp/oauth/token` | Exchange an authorization code for tokens or refresh access using a refresh token |
| `POST /mcp/oauth/revoke` | Revoke a token (RFC 7009) |

The media library connector uses the resource `https://gptunnel.ru/mcp/claude`. In its `401` response, `resource_metadata` points to `/.well-known/oauth-protected-resource/mcp/claude`, which advertises the `gallery:read` and `gallery:write` permissions. For full access, use `https://gptunnel.ru/mcp` and its metadata. Include the selected resource in OAuth requests.

For `redirect_uri`, use `https://`, `http://` on loopback addresses only (`localhost`, `127.0.0.1`, `::1`), or your app’s custom scheme (`cursor://…`).
