Skip to main content
This page documents every OAuth endpoint and its parameters. For a walkthrough of how the pieces fit together, see OAuth 2.1. All endpoints are served from the API base URL:

Discovery

Clients don’t hardcode endpoints — they read them from the server’s metadata. An unauthenticated request to a protected resource returns 401 with a WWW-Authenticate header naming the protected-resource metadata URL. The authorization-server metadata tells the client everything it needs:

Register a client

Register your app with Dynamic Client Registration (RFC 7591). The request needs no authentication, and there is nothing to create in Everhour beforehand.
The response returns a client_id. Everhour issues public clients only — there is no client_secret.

Authorize

Send the user to the authorization endpoint to sign in and approve access. Generate a PKCE code verifier and its S256 challenge first — plain challenges are rejected.
After the user clicks Allow, Everhour redirects to your redirect_uri with a one-time code (and your state). If the user declines, it returns an access_denied error.

Exchange the code for tokens

Exchange the code for tokens at the token endpoint. Because clients are public, no client authentication is sent — the PKCE code_verifier proves the request comes from the app that started the flow.
The response contains the access token and a refresh token:

Refresh a token

Access tokens last about an hour. When one expires, use the refresh token to get a new pair. Refresh tokens rotate — each refresh returns a new refresh token and invalidates the old one, so always store the latest.
The token keeps the same audience it was first issued for — a refresh can’t widen an /mcp token to the full API.

Token lifetimes

Because access tokens are stateless, there is no per-token revocation endpoint. To end access, stop using and refreshing the tokens — the access token expires within the hour, and the refresh token lapses once it’s no longer used.

Use a token with the REST API

Send the access token in an Authorization: Bearer header. A full-API token works on every REST endpoint, exactly where you’d otherwise send X-Api-Key:
When the token expires the API returns 401; refresh it and retry. A token that was narrowed to https://api.everhour.com/mcp is accepted only on /mcp — other paths return 401.

Security

  • PKCE is required. Only the S256 method is accepted; plain is rejected.
  • Clients are public. There is no client secret — never expect or store one.
  • Redirect URIs are matched exactly. Register only URIs you control, and use https (or http on loopback for local development).
  • Verify state. Send a random state on authorize and check it on the redirect to prevent CSRF.
  • Tokens are short-lived. Store them securely, prefer memory or an OS keychain over disk, and never commit them.
  • Everything is over HTTPS. All endpoints require TLS in production.