OAuth
How MCP clients sign in to Postalu: discovery, registration, PKCE, scopes, token lifetimes and revoking access.
When you add the Postalu address to a client that supports OAuth, the client signs you in in the browser and receives a token for your own workspace. You never copy a key, and you can cut the client off at any time. This page explains what happens, for people who want to know what they are approving and for developers building a client.
The flow
- The client calls
https://postalu.com/mcpand gets 401 with aWWW-Authenticateheader naminghttps://postalu.com/.well-known/oauth-protected-resource. - It reads the authorization server metadata at
https://postalu.com/.well-known/oauth-authorization-serverand registers itself athttps://postalu.com/oauth/register(RFC 7591). - It opens
/oauth/authorizein your browser with a PKCE S256 challenge. If you are signed out you sign in with your password and your two-factor code, exactly as for the studio. - Postalu shows who is asking and what it wants to read. You leave the boxes ticked or take any away, and press Approve.
- The browser returns to the client with a one-minute code. The client trades it, with its PKCE verifier, for an access token and a refresh token.
The client never sees your password or your authenticator code. Only people with two-factor on can approve an app, and App Review accounts that skip two-factor cannot.
Client registration
Registration is open to any app but rate limited per address. Every client is a public client: no secret is issued, and PKCE protects the code instead.
- Up to 5 redirect addresses. Each must be https, a loopback address (
http://127.0.0.1,http://[::1]orhttp://localhost, on any port), or the app's own private scheme such asantigravity://. javascript:,data:,file:and similar schemes are refused, and so is an address with a fragment or a user name.- An address that was not registered is never redirected to: the person is shown an error page instead.
token_endpoint_auth_methodmust benone.
Scopes
| Scope | What the app may do |
|---|---|
channels:read | See your connected accounts. Names and platforms of the accounts in your workspace. Never their sign-in keys. |
posts:read | Read your posts. Drafts, scheduled and published posts, and how they did. |
analytics:read | Read your insights. Reach, views and engagement over time, your top posts and your best times to post. |
posts:draft | Save drafts. Write posts and save them as drafts for you to review. Nothing goes out. |
posts:schedule | Schedule, change and cancel posts. Schedule a post for a time you give, edit the text or time of a scheduled post, or take it back to a draft. You can cancel anything in the studio. |
posts:publish | Publish posts right now. Publish a saved draft at once, to your real accounts. Asks for your password and a fresh code. |
A scope can only narrow what you can already do. There is no scope for billing, your team, settings, security or deleting anything, and there will not be one.
Tokens and lifetimes
| Token | Lasts | Notes |
|---|---|---|
| Sign-in code | 60 seconds | Works once. A wrong verifier uses it up. |
| Access token | 60 minutes | Sent as Authorization: Bearer …. |
| Refresh token | 30 days | Works once and is replaced by a new one. Showing an old one again closes the whole connection. |
| Access token made in Settings | 1 to 90 days | For clients without a browser. Needs your password and a fresh code to make. Shown once. |
Only hashes of tokens and codes are stored. The server checks the token, its connection, the person and the workspace on every call, so cutting a connection or switching a person off takes effect on the next request.
Revoking access
- Disconnect one app in Settings, Connected apps.
- Changing your password, resetting two-factor, being switched off or deleted, or the workspace dropping to the free plan stops every connection.
- A client can revoke its own token at
https://postalu.com/oauth/revoke(RFC 7009). The answer is always 200.
Errors from the token endpoint
| Error | Meaning |
|---|---|
invalid_client | The client_id is not registered (or its registration expired after 30 days unused). |
invalid_grant | The code or refresh token is wrong, used or expired, the redirect address differs, the PKCE verifier does not match, the person cannot sign in, or the connection was closed. |
invalid_target | The resource is not this server. |
unsupported_grant_type | Use authorization_code or refresh_token. |
| 429 | Too many requests from this address. Wait and retry. |