OAuth 2.1
Sign in with Hypris in your own app: server discovery, PKCE, scopes, tokens and refreshing.
On this page
On this page
OAuth 2.1 lets users sign in to your app with their Hypris account and grant it access without sharing a password or key. AI assistants connect via MCP the same way. Hypris supports the authorization code flow with PKCE and token refresh.
Key facts
| Flow | authorization_code with PKCE, method S256 (plain is rejected) |
| Refresh | refresh_token |
| Client registration | Client ID Metadata Document or dynamic registration (RFC 7591) |
| Client authentication | none (public client), client_secret_basic, client_secret_post, private_key_jwt (RFC 7523) |
| Access token | Valid for 1 hour, type Bearer |
| Refresh token | Valid for 30 days |
Server discovery
Don't hard-code addresses. The authorization server metadata is at the standard address, on the API domain but outside the version path:
https://api.hypris.com/.well-known/oauth-authorization-serverIn it you'll find authorization_endpoint, token_endpoint, registration_endpoint, revocation_endpoint and the list of scopes in scopes_supported. The MCP server also publishes /.well-known/oauth-protected-resource, so MCP clients find the authorization server without any configuration.
Client registration
You have two options:
Client ID Metadata Document. As
client_idyou provide the HTTPS address of a JSON document describing the app. Hypris fetches it itself, so you don't need to register anything. When the document lists several methods intoken_endpoint_auth_methods_supported, Hypris picks one you both support:private_key_jwtif the document publishes a key injwks_uriorjwks, andnoneotherwise.Dynamic registration. Send
POST https://api.hypris.com/v1/oauth/registerwithclient_name,redirect_urisand optionallytoken_endpoint_auth_method. Withprivate_key_jwt, also includejwks_uriorjwks. The endpoint doesn't require sign-in, but it's limited to 10 registrations per hour from one IP address.
The flow step by step
Generate a random
code_verifierand computecode_challengefrom it as base64url of SHA-256.Redirect the user to
authorization_endpointwith the parametersresponse_type=code,client_id,redirect_uri,scope,state,code_challengeandcode_challenge_method=S256.The user signs in, chooses a workspace and confirms the scopes on the consent screen.
Hypris redirects back to
redirect_uriwith thecodeandstateparameters. Check thatstatematches.Exchange the code for tokens at
token_endpoint.
curl -X POST "https://api.hypris.com/v1/oauth/token" \
-d grant_type=authorization_code \
-d code="$CODE" \
-d redirect_uri="https://your-app.com/callback" \
-d client_id="$CLIENT_ID" \
-d code_verifier="$CODE_VERIFIER"A confidential client adds its secret in the Basic header or in the client_secret field, according to the method chosen at registration.
A client with the private_key_jwt method sends a signed JWT instead of a secret, in the client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer and client_assertion fields. In the JWT, iss and sub are its client_id, aud is the token_endpoint or issuer address, and exp is at most an hour ahead. Each JWT works only once. Hypris checks the signature with the key from jwks_uri or jwks, and the supported algorithms are listed in token_endpoint_auth_signing_alg_values_supported.
Refreshing a token
curl -X POST "https://api.hypris.com/v1/oauth/token" \
-d grant_type=refresh_token \
-d refresh_token="$REFRESH_TOKEN" \
-d client_id="$CLIENT_ID"The response contains a new pair of tokens. Always save the new refresh_token in place of the old one.
Revoking a token
curl -X POST "https://api.hypris.com/v1/oauth/revoke" \
-d token="$REFRESH_TOKEN"The user can also revoke access themselves, in their account settings, under Authorized apps.
Scopes
| Scope | Required | What it grants |
|---|---|---|
profile | yes | Basic profile data |
email | yes | Email address |
user.workspaces.read | yes | The user's list of workspaces |
user.profile.write | no | Changing profile data |
user.status.read | no | Reading the user's status |
user.status.write | no | Setting the status |
user.settings.read | no | Reading settings |
user.settings.write | no | Changing settings |
workspace.mcp | no, on by default | Working on workspace data, including through MCP tools |
If you don't specify scope, the app gets only the required scopes. Separate scopes with a space.
What the app sees
The token is bound to the workspace chosen on the consent screen and can't reach any other. In that workspace, the app sees the intersection of two sets: the user's permissions and the permissions the administrator granted the app. It won't see anything the user can't see.
Errors
OAuth endpoints return errors in the RFC 6749 format, not in the usual API envelope:
{
"error": "invalid_grant",
"error_description": "…"
}The most common codes are invalid_client, invalid_grant, invalid_scope, unauthorized_client and unsupported_grant_type.