Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Managing a registration

A client that registered itself through an API also has to change and end that registration through one. This lesson follows the Photo Printer installation on Ava's phone as it reads and replaces its registration to rotate a key, and the printing company's pipeline as it deletes a review site's client, along with the credential that guards both and what still works once a client is gone.

The client configuration endpoint

Months after it registered, the Photo Printer installation on Ava's phone is due to replace its signing key. Rotating client credentials described the safe order: register the new public key alongside the old one, switch to signing with the new key, then remove the old one. That lesson also noted that when a registration holds keys directly, rather than the address of a key set, adding and removing keys means updating the registration. For a developer with a console, that is a form. For an installation that registered itself, it has to be another API call.

The OAuth 2.0 Dynamic Client Registration Management Protocol, published as RFC 7592, defines one. It is an Experimental RFC, published to encourage implementation and gather experience rather than on the standards track, and not every server that supports dynamic registration implements it; many offer their own management interfaces instead. Its design still shows the questions any registration management interface has to answer: how a client finds its registration, how it changes it safely, what protects it, and how it ends.

All domains, identifiers, keys, and tokens in these examples are fictional. The photo service supports RFC 7592, so its registration responses include the two members that Registration responses and errors mentioned. The installation's response began like this:

HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache

{
  "registration_client_uri": "https://auth.photos.example/register/app-7c41e2b9",
  "registration_access_token": "demo-registration-access-token-1",
  "client_id": "app-7c41e2b9",
  ...
}

registration_client_uri is the address of this client's client configuration endpoint, where the client reads and manages its own registration. The client uses the address exactly as given. Servers commonly build it from the registration endpoint and the client ID, as this one did, but a client must never construct it from those pieces itself.

registration_access_token is the credential that endpoint requires, sent as a bearer token on every call.

The endpoint uses the HTTP method to select the operation: GET reads the registration, PUT replaces it, and DELETE removes it. A server that does not support one of these methods must answer with an appropriate error.

Reading the current registration

GET /register/app-7c41e2b9 HTTP/1.1
Host: auth.photos.example
Accept: application/json
Authorization: Bearer demo-registration-access-token-1

The answer is 200 OK with the client's current registration, in the same format as the registration response. Current is meant literally. An administrator at the photo service may have narrowed the client's scope since it registered, or the server may have replaced a value. The installation learns what is actually registered, which may differ from what it remembers asking for.

The response may also contain a new client secret or a new registration access token. If it does, the client must discard the old one immediately and use the new one from then on, for reasons rotating the token comes back to. The client ID never changes.

Replacing the registration

To change anything, the client sends PUT with the complete registration. This is the part of the protocol that most often surprises developers: an update replaces the registration rather than merging changes into it. The request must contain every field as the server last returned it, and a field left out is treated as a request to remove it.

For the key rotation, the installation adds its new public key and sends everything else unchanged:

PUT /register/app-7c41e2b9 HTTP/1.1
Host: auth.photos.example
Content-Type: application/json
Accept: application/json
Authorization: Bearer demo-registration-access-token-1

{
  "client_id": "app-7c41e2b9",
  "client_name": "Photo Printer",
  "redirect_uris": ["https://app.printer.example/oauth/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "private_key_jwt",
  "jwks": {
    "keys": [
      { "kty": "EC", "crv": "P-256", "kid": "install-key-1", "x": "...", "y": "..." },
      { "kty": "EC", "crv": "P-256", "kid": "install-key-2", "x": "...", "y": "..." }
    ]
  },
  "scope": "photos.read"
}

A few rules shape the body. It must include client_id, matching the current one. It must not include registration_access_token, registration_client_uri, client_id_issued_at, or client_secret_expires_at, which belong to the server. A client that has a secret may include it, but only with its current value. A client can never choose its own secret.

Had the installation sent only client_id and the new jwks, the photo service would have treated every missing field as a request to remove it, and could have left a client with no redirect URI and no grants. The safe pattern is read, modify, write: fetch the current registration, change only what you mean to change, and send all of it back. RFC 7592 gives no way to detect that someone else changed the registration between that read and the write, so the last write wins.

A successful update returns 200 OK with the full registration, including any values the server replaced. Failures follow a short list:

ResponseMeaning
400A value is invalid and the server will not substitute one. The body uses the codes from Registration responses and errors, such as invalid_redirect_uri.
401The registration access token is not valid, or the client no longer exists.
403This client is not allowed to update its registration.

Read, modify, write

client_id
app-7c41e2b9
redirect_uris
https://app.printer.example/oauth/callback
grant_types
authorization_code, refresh_token
scope
photos.read
jwks
install-key-1, install-key-2

Only the key set changes

Only client_id and jwks

client_id
app-7c41e2b9
redirect_uris
left out
grant_types
left out
scope
left out
jwks
install-key-1, install-key-2

Each missing field is removed: no redirect URI and no grants

RFC 7592 gives no way to detect a change made between the read and the write, so the last write wins.

An update replaces the whole registration. The installation that read, modified and wrote back changes only its key set; one that sent only its client ID and keys loses every field it left out.

After the update succeeds, the installation signs its client assertions with install-key-2. Once the last assertion signed with the old key has expired, it reads the registration again and sends a second update without install-key-1.

A credential for one endpoint

Every one of those calls carried the same header, Authorization: Bearer demo-registration-access-token-1. That token is the only thing standing between the installation's registration and anyone who wants to change it.

A registration access token is an OAuth bearer token that the registration endpoint issues with a new registration. It is bound to one client ID and is meant for one place: that client's configuration endpoint. The server checks that the client named in the address is the client the token was issued for, so the token for app-7c41e2b9 cannot manage any other client.

With dynamic registration, three different credentials can surround one client, and they are easy to confuse:

CredentialUsed atWhat it allows
Initial access tokenThe registration endpointCreating new registrations, traceable to whoever was given the token
Registration access tokenOne client's configuration endpointReading, changing, and deleting that one registration
Client credential, such as a secret or private keyThe token endpoint and other back-channel endpointsAuthenticating as the client to obtain tokens

Why not let a client manage its registration with the credential it already has? Not every client has one. A public client registered with none has nothing to authenticate with, yet it still needs to manage its registration. The two jobs also belong at different endpoints and are used at different times, and a separate credential for each keeps each one where it is needed.

The separation does not make the registration access token the weaker of the two. Someone holding only a leaked client secret can obtain tokens as the client. Someone holding the registration access token can change the registration itself: point its redirect URIs at their own site, so that authorization codes for the client's users go to them, or delete the client altogether. On services where a read of the registration returns a new client secret, it can hand over the secret too. It deserves at least the protection the client secret gets.

Storing a registration access token

RFC 7592 says the token should not expire while the client remains registered. If it did, the client would have no way to read, update, or delete its own registration, and its only way forward would be a new registration with a new client ID. That makes it a long-lived bearer credential that is the sole proof needed at the configuration endpoint, and it deserves the same care as a refresh token:

  • The phone installation keeps it in the platform's secure storage, such as the Keychain or Android Keystore-backed storage, next to its private key.
  • A deployment pipeline that registers a client for each short-lived review site keeps each site's token in its secrets store and never writes it to a build log.
  • A token belongs to one registration and one holder. An app that shipped a single pre-made registration, token included, to every phone would let any one installation change or delete the registration all the others depend on.

On the server side, the token must contain enough randomness that guessing it is hopeless, and the server can store only a hash of it, as it would a client secret. When a client is deleted, its registration access token must be invalidated at the same moment, so that a token for a client that no longer exists cannot even authenticate.

Rotating the token

To limit how long any one token is exposed, the server may issue a new registration access token when the client reads or updates its registration. The new value arrives in the response:

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache

{
  "registration_access_token": "demo-registration-access-token-2",
  "registration_client_uri": "https://auth.photos.example/register/app-7c41e2b9",
  "client_id": "app-7c41e2b9",
  ...
}

The client must discard demo-registration-access-token-1 and use the new token from then on, and the server should stop accepting the old one where it can. Because a response is the only way a client learns about a new token, reads and updates are also the only sensible moments to rotate it, rather than letting the token quietly change or expire at some other time.

The server decides when to rotate, not the client. The protocol gives a client no way to ask for a fresh token, so a client that suspects its token has leaked has two options: whatever the service offers outside the protocol, or deleting its registration and registering again under a new client ID, after which people have to approve it again.

Rotation brings back the lost-response problem from Refresh tokens and rotation. If the response carrying the new token is lost on the way, the client still holds the old token, which the server may already have stopped accepting, and the client is locked out of its own registration. A client should store the new token durably before it does anything else with the response. A server could keep the old token valid until the client first uses the new one, avoiding the lockout at the cost of two working tokens for a short time, the same trade-off that lesson described for refresh tokens.

Deleting a registration

The change behind review site 482 has been merged, and the pipeline is tearing the site down. Its client at the photo service should not outlive it. A registration left behind is a client ID that still works, with a redirect URI on an address that may one day serve something else.

The pipeline sends DELETE to the client's configuration endpoint, with the registration access token it received when it registered the client:

DELETE /register/review-482-b17f HTTP/1.1
Host: auth.photos.example
Authorization: Bearer demo-registration-access-token-482

HTTP/1.1 204 No Content
Cache-Control: no-store
Pragma: no-cache

204 No Content confirms that the client has been removed. Its client ID, client secret, and registration access token are now all invalid, and the photo service will refuse review-482-b17f at both the authorization endpoint and the token endpoint.

Other answers mean something different. 405 means the server does not support deletion through this endpoint, so the client has to be removed some other way. 403 means this client is not allowed to delete itself. 401 means the token is not valid or the client does not exist, and those two look the same on purpose. A pipeline that already saw 204 for this client and gets 401 on a second attempt knows the client is gone. A pipeline whose first request was interrupted, and whose retry gets 401, does not: its token might simply be stale. It keeps its copy of the credentials until someone with access to the service's client list confirms the deletion.

Once the client is gone, the pipeline deletes its own copies of the client secret and the registration access token.

What happens to issued tokens

Deleting a client does not automatically reach everything the client was given. RFC 7592 says the authorization server should, where possible, immediately invalidate every authorization grant, access token, refresh token, and other token associated with the client. How far that reaches depends on where each token is checked:

  • Refresh tokens and unused authorization codes are presented to the authorization server, which knows the client is gone. They stop working.
  • Reference access tokens that the photo API checks through introspection stop working as soon as the authorization server reports them inactive.
  • Self-contained JWT access tokens that the photo API validates locally may remain usable while its current checks pass, until expiry, as Token revocation described. The API has no reason to ask about a token whose signature and claims check out.

Short access token lifetimes keep that window small, and an API protecting something sensitive can use introspection instead of trusting a JWT until it expires.

The grants people approved end as well. If someone had connected a test photo account to review site 482, the connection would disappear from that account's list of connected applications, because the application it named no longer exists.

Registrations nobody deletes

The pipeline deletes its clients because it knows when a site goes away. An app on a phone rarely gets that chance. Uninstalling an app normally gives it no opportunity to run code, so it cannot send a DELETE. An installation that is reset or reinstalled simply registers again, and its old client stays behind with a client ID and registration access token that nothing will ever use.

An authorization server that accepts dynamic registrations therefore needs its own cleanup. It can expire registrations that have not been used for a long time, invalidating their registration access tokens at the same moment, and its operators can remove a client that abuses the service. A client can discover that it was removed: the token endpoint answers invalid_client, and its configuration endpoint answers 401. Either answer tells it that its registration, or at least its credential, can no longer be used. An installation in that state registers again, and a careful one first checks whether the old registration is really gone, so that it does not leave a second forgotten client behind.

Three ways access ends

Deleting a registration is the broadest of three actions that end a client's access, and they are easy to mix up:

ActionWho takes itWhat ends
The client revokes its tokensThe client, at the revocation endpointThe tokens it revokes and, when it revokes a refresh token, often the access tokens issued under the same grant. The client and its registration remain.
A person disconnects the clientThat person, such as Ava, in their account's list of connected applicationsTheir grant to that client and the tokens issued under it. The client remains, and other people's connections are untouched.
The registration is deletedThe client, through its configuration endpoint, or the authorization server's operatorsThe client itself, and with it every grant and token the server can still reach.

In all three cases, a self-contained token checked without current revocation information may still be accepted until it expires. What differs is what survives: revocation leaves the client registered, a disconnection leaves the client but not that person's grant, and deletion leaves nothing at all.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

An installation sends a PUT containing only its client_id and a new jwks. What may happen to its redirect URIs? 1 of 4

Choose one answer.

A client registration has just been deleted. What happens to a self-contained JWT access token issued to that client? 2 of 4

Choose one answer.

An app ships a single pre-made registration, registration access token included, to every phone that installs it. What can any one installation do with that token? 3 of 4

Choose one answer.

A pipeline's first DELETE for its review site client was interrupted, and its retry gets 401. What should it conclude? 4 of 4

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity