Discovery
GET <issuer>/.well-known/openid-configurationAnswers with the issuer and its endpoints. Point your library at the issuer and let it read this document, rather than writing the endpoints into your configuration. It may be cached for five minutes.
| Field | Value |
|---|---|
issuer | https://auth.nubisco.io/e/<environment id> |
response_types_supported | code |
grant_types_supported | authorization_code, client_credentials |
code_challenge_methods_supported | S256 |
scopes_supported | openid, profile, email |
prompt_values_supported | none, login |
id_token_signing_alg_values_supported | RS256 |
token_endpoint_auth_methods_supported | client_secret_post, client_secret_basic, none |
The discovery document and the keys answer only for an environment of an approved workspace.
Keys and the key ring
GET <issuer>/.well-known/jwks.jsonThe public keys that sign your environment's tokens, as a JSON Web Key Set. Every key is RSA, used for RS256 signatures, and has a kid. Each token's header names the kid that signed it.
Each environment has its own key ring, and the set holds up to three keys:
- the current key, which signs new tokens,
- the next key, published ahead of time so your app already has it when signing moves to it,
- the previous key, kept until the tokens it signed have expired.
So pick the key by kid, cache the set (it may be cached for five minutes), and fetch it again when a token names a kid you do not have. Never pin one key in your configuration. A token signed by another environment's keys never verifies against yours.
Starting a sign-in
GET <issuer>/authorize| Parameter | Required | What |
|---|---|---|
response_type | yes | code |
client_id | yes | Your app's client id |
redirect_uri | yes | One of the app's redirect URIs, exactly as registered |
state | yes | An unguessable value you check when the person comes back |
scope | yes | Must include openid. May add profile and email |
code_challenge | recommended | The PKCE challenge: base64url of the SHA-256 of your verifier, 43 characters |
code_challenge_method | with challenge | S256. No other method is accepted |
nonce | recommended | Returned in the ID token, so you can tie the token to this request |
prompt | no | login to ask the person to sign in again, none to never show a page |
organization | no | An organization's id or slug. See Choosing an organization |
If the person is not signed in to your environment, Accord shows the environment's sign-in page and then carries on. If they are, it returns straight away. On success the browser goes to your redirect_uri with code and state. The code is single use and expires after five minutes.
A request with no client_id, redirect_uri or state, an unknown client, or a redirect_uri that is not registered gets a 400 with a JSON error and no redirect. Every other problem goes back to your redirect_uri with error, state and sometimes error_description:
error | Why |
|---|---|
unsupported_response_type | response_type is not code |
unauthorized_client | The app may not use the authorization code grant |
invalid_request | A malformed PKCE challenge, or a public client without one |
invalid_scope | openid is missing, or a scope the app may not ask for |
login_required | prompt=none and the person is not signed in |
access_denied | The person may not use this app. error_description is not_a_member or domain_not_allowed |
organization_required | The app needs an organization and the person belongs to none that use it |
organization_selection_required | The person belongs to several organizations that use the app and none was named |
invalid_organization | The named organization does not use this app, or the person is not a member |
PKCE
Send a PKCE challenge on every sign-in. Make a random verifier of 43 to 128 characters from A-Z, a-z, 0-9 and -._~, send its S256 challenge to /authorize and the verifier to /token. When the code was issued with a challenge, the token endpoint refuses it without the matching verifier.
Exchanging the code
POST <issuer>/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=<code>
&redirect_uri=https://app.example.com/auth/callback
&code_verifier=<verifier>
&client_id=<client id>
&client_secret=<client secret>The body may also be JSON. The client may authenticate with client_id and client_secret in the body, or with HTTP Basic (client_secret_basic). redirect_uri must be the one the code was issued for.
json
{
"access_token": "eyJ...",
"id_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "openid profile email"
}Both tokens last one hour. There is no refresh token: see Staying signed in.
Accord checks the person again at this step: that they are still active, still allowed in the app and still in the organization the code was for. A code for someone who lost access in between is refused.
| Status | error | Why |
|---|---|---|
| 401 | invalid_client | Unknown client, wrong secret, or the workspace is not issuing |
| 400 | unsupported_grant_type | Not authorization_code or client_credentials |
| 400 | unauthorized_client | The app may not use this grant |
| 400 | invalid_request | code or redirect_uri is missing |
| 400 | invalid_grant | The code is unknown, spent, expired, for another redirect_uri, or the verifier does not match, or the person lost access |
For the client credentials grant, see Machine API and roles.
The person: userinfo
GET <issuer>/userinfo
Authorization: Bearer <access token>json
{
"sub": "<person id>",
"email": "ada@example.com",
"email_verified": true,
"name": "Ada",
"preferred_username": "ada@example.com",
"locale": "pt-PT"
}Only a person's access token from this environment is accepted. A machine token, an ID token or an expired token gets 401 invalid_token. name may be null for a person who has not given one. locale is the person's language as saved now, for an access token with the profile scope, and is left out when the person follows their browser's language (see the person's language).
Choosing an organization
For an app whose people come from organizations, a person who belongs to several organizations that use the app must pick one. The first sign-in comes back with organization_selection_required. Show your own picker, then start the sign-in again with organization=<id or slug>. A person in exactly one organization that uses the app gets it without asking. See Organizations for the claims that result.
Staying signed in
A sign-in at your environment lasts seven days in that browser. Access and ID tokens last one hour, and there are no refresh tokens yet. To renew, send the browser to /authorize again with prompt=none: while the sign-in lasts it comes straight back with a new code, and after that it comes back with login_required, and you start a normal sign-in.
Signing out
GET <issuer>/end-session?client_id=<client id>Ends the person's sign-in at your environment in this browser and shows the environment's sign-in page. Sign the person out of your own app first.
Not built yet
- Refresh tokens. Use
prompt=noneas above. - The device authorization grant (signing in on a TV or console with a code typed on a phone) is not available in customer environments.
- Returning to your app after sign-out. There is no way to register a return address yet, so the browser always lands on the sign-in page.
- Social sign-in other than Google. People sign in with an emailed code or Google (then a second step when they have one), or with a passkey. See Signing in.