PostaluPostalu

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

  1. The client calls https://postalu.com/mcp and gets 401 with a WWW-Authenticate header naming https://postalu.com/.well-known/oauth-protected-resource.
  2. It reads the authorization server metadata at https://postalu.com/.well-known/oauth-authorization-server and registers itself at https://postalu.com/oauth/register (RFC 7591).
  3. It opens /oauth/authorize in 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.
  4. Postalu shows who is asking and what it wants to read. You leave the boxes ticked or take any away, and press Approve.
  5. 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] or http://localhost, on any port), or the app's own private scheme such as antigravity://.
  • 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_method must be none.

Scopes

ScopeWhat the app may do
channels:readSee your connected accounts. Names and platforms of the accounts in your workspace. Never their sign-in keys.
posts:readRead your posts. Drafts, scheduled and published posts, and how they did.
analytics:readRead your insights. Reach, views and engagement over time, your top posts and your best times to post.
posts:draftSave drafts. Write posts and save them as drafts for you to review. Nothing goes out.
posts:scheduleSchedule, 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:publishPublish 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

TokenLastsNotes
Sign-in code60 secondsWorks once. A wrong verifier uses it up.
Access token60 minutesSent as Authorization: Bearer ….
Refresh token30 daysWorks once and is replaced by a new one. Showing an old one again closes the whole connection.
Access token made in Settings1 to 90 daysFor 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

ErrorMeaning
invalid_clientThe client_id is not registered (or its registration expired after 30 days unused).
invalid_grantThe 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_targetThe resource is not this server.
unsupported_grant_typeUse authorization_code or refresh_token.
429Too many requests from this address. Wait and retry.