Skip to content

OAuth

If you use Claude, ChatGPT or another assistant with MCP connectors, you don’t need any of this: do it as explained in MCP. This page is for anyone building their own client.

Ordenly implements OAuth 2.1 with:

  • mandatory PKCE (S256);
  • public clients, with no secret;
  • dynamic client registration;
  • discovery through metadata.

Discovery

Document Address
Protected resource (RFC 9728) https://api.ordenly.app/.well-known/oauth-protected-resource
Authorization server (RFC 8414) https://api.ordenly.app/.well-known/oauth-authorization-server

The resource is https://api.ordenly.app/mcp. The scopes are read and write; write includes read.

1. Register the client

POST https://api.ordenly.app/oauth/register (RFC 7591):

{ "client_name": "My assistant", "redirect_uris": ["https://example.com/callback"] }
  • Between 1 and 5 redirect_uris, with no fragment.
  • Accepted are https, http only to localhost, 127.0.0.1 or [::1] (desktop applications), and custom application schemes with a dot (com.example.app:/oauth).
  • It responds 201 with the client_id. There is no secret: token_endpoint_auth_method is none.

2. Ask for permission

Send the person to:

https://api.ordenly.app/oauth/authorize
?response_type=code
&client_id=<client_id>
&redirect_uri=<one of the registered ones>
&code_challenge=<BASE64URL(SHA256(verifier))>
&code_challenge_method=S256
&scope=read%20write
&state=<random>
&resource=https://api.ordenly.app/mcp

Ordenly takes them to its permission screen. They must sign in with their Owner or Admin account for the property, and the property must have the Pro plan. On allowing, they return to your redirect_uri with:

  • code: valid for 60 seconds and one use;
  • state: yours, unchanged;
  • iss: https://api.ordenly.app (RFC 9207). Check it.

If they don’t allow it, they return with error=access_denied. If the client_id or the redirect_uri aren’t valid, nobody is redirected anywhere: Ordenly’s screen explains it.

3. Exchange the code

POST https://api.ordenly.app/oauth/token, application/x-www-form-urlencoded:

grant_type=authorization_code
&code=<code>
&redirect_uri=<the same one>
&client_id=<client_id>
&code_verifier=<verifier>
{
"access_token": "ordat_…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "ordrt_…",
"scope": "read write"
}

A code with the wrong verifier becomes unusable: you have to ask for permission again.

4. Use the token

Authorization: Bearer ordat_… on the MCP server and on the routes of the API, with the granted scope. It lasts one hour.

5. Refresh

grant_type=refresh_token
&refresh_token=<refresh_token>
&client_id=<client_id>
  • Every refresh gives a new pair, and the previous access token stops being valid.
  • The refresh token lasts 30 days from the last time it was used.
  • Always keep the latest one. A refresh token that was already used and arrives again is treated as stolen and revokes the whole permission: the person will have to authorize again.

Revoke

POST https://api.ordenly.app/oauth/revoke with token=<access or refresh> (RFC 7009). It always responds 200. The property’s Owners and Admins can also disconnect the assistant from the back office.

Errors

The /oauth/* routes follow the standard: { "error": "invalid_grant", "error_description": "…" }, with 400 (or 401 for invalid_client). The most common:

error When
invalid_redirect_uri When registering, an address that isn’t accepted
invalid_request PKCE or a parameter is missing
invalid_scope A scope that is neither read nor write
invalid_grant Expired or used code, or one with a different verifier; used or expired refresh token
unsupported_grant_type Another grant_type
slow_down Too many requests (429)