Discovery
Clients don’t hardcode endpoints — they read them from the server’s metadata. An unauthenticated request to a protected resource returns401 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 itsS256 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 thecode 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.
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./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 anAuthorization: Bearer header. A full-API token works on every REST endpoint, exactly where you’d otherwise send X-Api-Key:
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
S256method is accepted;plainis 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(orhttpon loopback for local development). - Verify
state. Send a randomstateon 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.
