# Sign in with DECA

> MCP clients such as Claude, ChatGPT and Cursor connect with your DECA account through OAuth 2.1 with PKCE. Nothing to paste.

A client that supports OAuth can connect with your DECA account instead of a pasted [API key](https://app.decalabs.ai/docs/reference/authentication). The workspace's owner approves the client once, and the client gets a key of its own that you can revoke at any time.

## For people

1. Add `https://app.decalabs.ai/mcp` as a connector in your client. In Claude, choose **Sign in when needed**: the free tools work at once, and you are asked to sign in only when a tool needs your workspace. Choose **Sign in now** to sign in right away. See [Connect Claude](https://app.decalabs.ai/docs/connect/claude).
2. DECA opens a page that names the client and what it could do. Only the workspace's owner can approve it.
3. After you approve, the client gets a key with the `read`, `quote` and `test` scopes. It appears under **MCP & API** as "*client* · connected *date*". Revoke it there to disconnect.

| Scope | What the client may do |
|---|---|
| `read` | Read signals, ideas, benchmarks, your workspace's ideas and your tests |
| `quote` | Price tests with `quote_test` |
| `test` | Pay for and cancel tests |

## For client builders

DECA follows the MCP authorization spec: OAuth 2.1 with PKCE (`S256`), dynamic client registration (RFC 7591), authorization server metadata (RFC 8414) and protected resource metadata (RFC 9728).

| | |
|---|---|
| Protected resource metadata | `https://app.decalabs.ai/.well-known/oauth-protected-resource/mcp` |
| Authorization server metadata | `https://app.decalabs.ai/.well-known/oauth-authorization-server` |
| Registration | `POST https://app.decalabs.ai/register` |
| Authorization | `https://app.decalabs.ai/authorize` |
| Token | `POST https://app.decalabs.ai/token` |
| Resource | `https://app.decalabs.ai/mcp` |
| Scopes | `read`, `quote`, `test`. None asked means all three. |

### The flow

1. **Discover.** A tool that needs a workspace, called with no key, answers `401` with `WWW-Authenticate: Bearer realm="deca", resource_metadata="https://app.decalabs.ai/.well-known/oauth-protected-resource/mcp"`. The resource metadata names the authorization server.
2. **Register.** `POST /register` with `redirect_uris` (one to ten; `https`, or `http` to `localhost` only) and a `client_name`. Only public clients are supported: `token_endpoint_auth_method` is `none`.
3. **Authorize.** Send the person to `/authorize` with `response_type=code`, your `client_id`, `redirect_uri`, `state`, `scope` and a PKCE `code_challenge` with `code_challenge_method=S256`.
4. **Exchange.** `POST /token` with `grant_type=authorization_code`, the `code`, your `redirect_uri`, `client_id` and the `code_verifier`. A code is good once, for ten minutes.
5. **Call.** Send the `access_token` as `Authorization: Bearer` on every MCP or REST call.

```bash title="Register"
curl -X POST https://app.decalabs.ai/register \
  -H "content-type: application/json" \
  -d '{"client_name": "My agent", "redirect_uris": ["http://localhost:8976/callback"], "token_endpoint_auth_method": "none"}'
```

```bash title="Token"
curl -X POST https://app.decalabs.ai/token \
  -d grant_type=authorization_code \
  -d code=CODE \
  -d redirect_uri=http://localhost:8976/callback \
  -d client_id=CLIENT_ID \
  -d code_verifier=VERIFIER
```

The token answer:

```json
{ "access_token": "deca_sk_…", "token_type": "Bearer", "scope": "read quote test" }
```

The access token is an ordinary DECA API key, so everything a key does holds for it: scopes, the [rate limit](https://app.decalabs.ai/docs/reference/limits) of 600 calls a minute, and calls counted in the dashboard. It does not expire and there is no refresh token; it stops working when the workspace's owner revokes it under **MCP & API**.

## Next

- [API keys](https://app.decalabs.ai/docs/reference/authentication): make a key by hand, set caps on what it may spend.
- [Errors](https://app.decalabs.ai/docs/reference/errors): `invalid_key`, `key_revoked` and `scope_missing`.

Source: https://app.decalabs.ai/docs/reference/sign-in
