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

# Authentication

> How assistants sign in to PostChamp with OAuth 2.1, what the consent screen asks, how long tokens last and how to revoke access.

PostChamp is its own OAuth 2.1 authorization server for assistants. There are no API keys for MCP: the assistant opens your browser, you sign in and approve, and it receives a token you can revoke at any time.

## Who can connect

* **Owners and admins only.** Editors, viewers and client reviewers cannot connect an assistant, and a connection stops working for a workspace when your role there drops below admin.
* **A paid plan.** Assistants are included on every plan. A workspace without an eligible plan shows "Assistants need a paid plan." on the consent screen and an upgrade prompt in Settings.
* **An active workspace.** A locked workspace shows "This workspace is locked." and cannot be connected.

> [!NOTE]
>
> These checks run on every tool call, not only when you connect. If your role, the plan or the workspace changes, the next call fails with `forbidden` or `plan_limit`.

## The sign-in flow

**1. Discovery**

The assistant calls the MCP server without a token and gets `401` with a `WWW-Authenticate` header that names the protected resource metadata. From there it finds the authorization server.

**2. Registration**

The assistant identifies itself with dynamic client registration or a client ID metadata document (see below).

**3. Authorization**

Your browser opens PostChamp. If you are not signed in, you sign in first. Authorization uses PKCE with S256 only.

**4. Consent**

You choose workspaces and approve. PostChamp sends the assistant back to its own redirect address with a code, and the assistant exchanges it for tokens.

### Discovery documents

These are public, served with CORS open to every origin and cached for five minutes.

| Document | Where |
| - | - |
| Protected resource metadata (main endpoint) | `https://api.postchampai.com/.well-known/oauth-protected-resource/api/v1/mcp` (also at `/.well-known/oauth-protected-resource`) |
| Protected resource metadata (ChatGPT app) | `https://api.postchampai.com/.well-known/oauth-protected-resource/api/v1/mcp/chatgpt` |
| Authorization server metadata (RFC 8414) | `/.well-known/oauth-authorization-server/api/auth` on the app host, and `/.well-known/oauth-authorization-server` on the API host as a fallback |
| OpenID configuration | `/.well-known/openid-configuration` on the same hosts |

The protected resource document lists `mcp` as the scope, bearer tokens in the `Authorization` header, and the authorization server. The authorization server is the app host with `/api/auth` as the issuer.

### Registering a client

PostChamp accepts two ways for an assistant to identify itself:

* **Dynamic client registration.** Open to public clients that use no secret (`token_endpoint_auth_method: none`). A registered client may hold the scopes `mcp` and `offline_access` only. Limit: 10 registrations per IP address per hour.
* **Client ID metadata documents (CIMD).** When the `client_id` is an `https` URL with a path, PostChamp fetches the JSON document at that URL. The `client_id` must equal the URL, and `client_name` and `redirect_uris` are required. The fetch is limited to public addresses, 64 KB and 5 seconds, with no redirect. Results are cached for 24 hours, or the document's `Cache-Control` up to 7 days. Limits: 10 fetches per requesting IP and 30 per target host per minute.

Redirect addresses must match exactly. They must be `https`, or `http` on a loopback host (any port).

Requests to the authorize endpoint are limited to 30 per IP address per minute.

## The consent screen

When an assistant asks to connect, PostChamp shows who is asking and what it can do.

![The consent screen: Example assistant wants to connect to PostChamp, a list of workspaces with checkboxes, what it can do, and Approve and Cancel buttons](/images/mcp/consent.png)

1. Who is asking, and the account you are signed in as  2. Workspaces the assistant may use  3. What it can do  4. Approve

1) **Who is asking.** The heading names the app. If it registered itself, the screen warns "Unverified app. Only continue if you started this connection yourself." and shows the address it will send you back to. Apps that identify through a metadata document also show the host that publishes it. You can switch account from here.
2) **Workspaces.** Tick the workspaces the assistant may use. Workspaces you cannot connect are listed with the reason: only owners and admins can connect, assistants need a paid plan, or the workspace is locked.
3) **What it can do.** Read your posts, voice and knowledge base. Write drafts. Schedule posts after you confirm. It never posts without asking.
4) **Approve or Cancel.** Cancel returns an `access_denied` error to the assistant.

The consent link expires. If you see "This request has expired", start the connection again from your assistant.

The workspaces you tick become the assistant's **grants**. The ChatGPT app is the exception: it works with exactly one workspace and the screen shows radio buttons. See [ChatGPT app](/mcp/chatgpt-app.md).

## Scope and tokens

* **Scope.** The one MCP scope is `mcp`. A token without it gets `403` with `error="insufficient_scope"`. `offline_access` is added so the assistant can refresh, and is never advertised.
* **Audience.** Tokens carry the resource they were issued for. The main endpoint and the ChatGPT app endpoint do not accept each other's tokens.
* **Lifetime.** Access tokens last 60 minutes. Refresh tokens last 30 days and rotate on use.
* **Storage.** Tokens are opaque. PostChamp stores only their SHA-256 hash and checks the token against the database on every request.

## Using several workspaces

A connection can hold more than one workspace. The assistant then passes a `workspace` argument on each call. See [workspace argument](/mcp/limits-and-errors.md#the-workspace-argument).

## Manage and revoke connections

Open [Settings → Assistants](https://app.postchampai.com/settings/assistants). It lists each connection with the assistant name, the person who connected it, its workspaces, when it was connected and when it was last used.

* **Edit workspaces.** Change which workspaces your own connection may use. For someone else's connection the action is **Remove workspaces**: an admin can take workspaces away, but only the person who connected it can add workspaces, by connecting again.
* **Disconnect.** The assistant stops working right away: the next request with its token fails. Drafts it made stay in your workspaces.

Owners and admins see every connection that touches workspaces they manage. If someone is removed from a workspace, their connection to it is revoked.

> [!WARNING]
>
> Removing the connector inside the assistant does not always revoke the sign-in at PostChamp. Disconnect in Settings as well.

## Per-client tool allowlist

PostChamp can restrict a registered client to a subset of tools. A tool outside the list does not appear in `tools/list` and calling it returns an unknown tool error. Clients without a list get every tool. This is set by PostChamp on the client record, not in the app.

## Troubleshooting

> [accordion] The assistant keeps asking me to sign in
>
> The token was revoked, or every workspace was removed from the connection. Reconnect the assistant and choose at least one workspace.

> [accordion] Tool calls return 'Sign in to PostChamp to use this connector.'
>
> This is the `401` the server sends when no valid token arrives. Re-authorize from the assistant.

> [accordion] The consent screen says I cannot connect any workspace
>
> You need to be an owner or admin of a workspace on a paid plan. Ask an owner to change your role, or change the plan in Settings.

> [accordion] The assistant says the client is not valid or disabled
>
> A client that PostChamp has disabled is refused with `client is disabled`. Use another assistant, or contact support.

## Related

> [card] [Limits and errors](/mcp/limits-and-errors.md)
>
> Rate limits and the error shape.

> [card] [Connect a client](/mcp/clients/index.md)
>
> Setup guides for every client.
