Start free
Docs · OAuth

Developer docs

OAuth for Beplan apps: endpoints, PKCE and tokens

Beplan is an OAuth 2.1 authorization server for its API and its MCP server. This page lists its endpoints and the rules a client must follow. For a walk-through, start with the OAuth app quickstart.

Read as Markdown

On this page
  1. Endpoints
  2. Grants and PKCE
  3. Resources
  4. Scopes at authorization
  5. Clients
  6. Tokens
  7. Revoke
  8. Introspect
  9. Errors at the authorization server

Endpoints

URL
Authorization https://api.beplan.io/api/auth/oauth2/authorize
Token https://api.beplan.io/api/auth/oauth2/token
Revocation (RFC 7009) https://api.beplan.io/api/auth/oauth2/revoke
Introspection (RFC 7662) https://api.beplan.io/api/auth/oauth2/introspect
Dynamic registration (RFC 7591) https://api.beplan.io/api/auth/oauth2/register
Authorization server metadata (RFC 8414) https://api.beplan.io/.well-known/oauth-authorization-server
API resource metadata (RFC 9728) https://api.beplan.io/.well-known/oauth-protected-resource
MCP resource metadata https://api.beplan.io/.well-known/oauth-protected-resource/mcp

The issuer is https://api.beplan.io/api/auth. There is no OpenID Connect: no ID token, no userinfo endpoint, no published key set. GET /v1/me is the identity call. The token, revocation, introspection and registration endpoints accept calls from any web origin, without cookies.

Grants and PKCE

  • Authorization code and refresh token only. No client credentials, device code or token exchange: every token acts for a person.
  • PKCE with S256 on every authorization request, confidential clients included. plain is not accepted.
  • The authorization response includes iss; check it equals the issuer.
  • prompt=consent shows the consent screen even when the person already agreed; prompt=none is kept. prompt=login, prompt=create and max_age are ignored.

Resources

Every token is for one resource:

Resource Value of resource
The REST API https://api.beplan.io
The MCP server https://api.beplan.io/mcp

Without resource, an app registered in Beplan gets an API token, and a client that registered itself gets an MCP token. Any other value is refused with invalid_target. A token for one resource is refused by the other (401).

Scopes at authorization

  • scope is space-separated. Beplan's scopes are in the scope table; all is not available through OAuth.
  • A scope the client did not declare is dropped, not refused. If nothing usable is left, the request asks for every scope the client declared.
  • offline_access is always added: every connection gets a refresh token.
  • On the consent screen the person can untick any scope you didn't mark required, and picks the organizations and workspaces. The token's scope says what they kept.

Clients

Client type Who Authentication at the token endpoint
Confidential A server that keeps a secret HTTP Basic with the client id and secret (client_secret_basic)
Public A native or browser app client_id only (none); PKCE is the protection

client_secret_post and private_key_jwt are refused. A client secret starts with beplan_cs_, is shown once, and can be rotated on the app's page: the old secret stops at once, tokens already issued keep working.

Registered apps and self-registered clients

Apps made in Beplan (organization settings → Developer) are described in the OAuth app quickstart. Dynamic registration is open for MCP assistants: a self-registered client may hold only non-sensitive scopes unless Beplan recognizes it, and is shown on the consent screen as an assistant Beplan recognizes, a program on this computer, or an assistant it can't identify. Registration is limited to 10 per hour per IP address. Build an app instead if you are making a product.

Redirect addresses

  • Matched exactly: no wildcards, no prefix matching. Up to five per app.
  • https:// only, without a fragment or credentials.
  • Native apps may also use loopback addresses on any port (http://localhost, http://127.0.0.1, http://[::1]) and private-use schemes in reverse-domain form (com.example.app:/callback).

Tokens

Lifetime
Authorization code Single use, 10 minutes
Access token 1 hour (expires_in), a signed JWT for one resource
Refresh token 90 days; replaced at every refresh

Refresh rotation: each refresh returns a new refresh token. The previous one still works for 30 seconds (for retries). Used after that, or a code used twice, ends the whole connection: every token of it stops, and the person has to connect again.

The token answer: access_token, token_type (Bearer), expires_in, expires_at, refresh_token, scope.

Revoke

curl -X POST "https://api.beplan.io/api/auth/oauth2/revoke" \
  -u "CLIENT_ID:CLIENT_SECRET" \
  -d token=REFRESH_TOKEN \
  -d token_type_hint=refresh_token

Revoking a refresh token ends the connection between that person and your client: every access token of it stops on the next request, and your app gets connection.revoked with reason app. A public client sends client_id instead of Basic authentication.

Introspect

Confidential clients only, with HTTP Basic. A token whose connection was revoked answers { "active": false }, even before it expires. See authentication.

Errors at the authorization server

The OAuth endpoints answer with OAuth's own error format ({ "error", "error_description" }), not the API's envelope: invalid_request (a missing PKCE challenge, a plain challenge…), invalid_client, invalid_grant (a code used twice, or a refresh token that no longer exists because the connection ended), invalid_target, access_denied (the person declined, or a token was asked for a connection that is no longer live). The token and authorization endpoints are limited to 60 requests per minute per IP address.