Authorization server responsibilities
Every exchange so far has ended at the photo service's authorization serverIn OAuth, the service that handles a person's sign-in and approval and decides which tokens to issue to a client. It may belong to the same company as the API, but its job is separate., and it has always answered correctly. Those answers depend on records and keys that someone keeps in order for years: a registry of clients, a history of approvals, signing keys, and a log of what happened.
Keeping the client registry
In every exchange so far, the authorizationDeciding whether a requested action is permitted, such as whether a signed-in account may delete a particular photo. Authentication says which account is asking; authorization decides what it can do. server recognized the printer, showed Ava an approval screen, issued codes and tokens, and refused requests that broke the rules. Some organizations run their own authorization server, and many use an identity product that runs it for them. The responsibilities are the same either way. Knowing them helps when choosing that product, configuring it, or asking what it does when something goes wrong.
Client IDs and registration showed what a registration records. Running a registry adds two questions: who may create those records, and how do they stay accurate?
The photo service lets any developer register a client and try it with their own photo account. Before a client can ask other people for access, someone reviews it. Does the printing company control printer.example? Do the redirect URIs belong to that domain? Do the requested scopes match what the application does, and does the name on the consent screen match the company behind it? A later change to a redirect URI gets the same review, because it changes where codes can be sent.
A registry also needs cleaning. Clients whose developers have left, test clients nobody uses, and secrets that were never rotated accumulate quietly. Recording when each client last obtained a tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. makes them easy to find. A client unused for a year can be disabled, with a message to its registered contacts, and removed later if nobody objects. The same records let the service suspend a misbehaving client within minutes rather than days.
Recording approvals
The authorization server also authenticates people. Ava's sign-in happens on its pages, which is why the printer never sees her password, and also why those pages repay an attacker's effort. The protections described in Authentication methods and MFA apply here with particular force, because one account at the photo service may stand behind many connected applications.
Once Ava approves the printer, the server keeps a record of that decision: the grant that Refresh tokens and rotation showed, with its refresh tokenA longer-lived credential that a client sends to the authorization server, never to an API, to get new access tokens without asking the person again. families hanging from it. Running the server means deciding what else that record drives, and it drives a good deal. When the printer asks again for the same or narrower access, the server can skip the approval screen, because the decision has already been made and only the printer's backend, which authenticates itself, can redeem the code that follows. A phone app is different: anyone can send a request with its client ID, so for a public clientAn OAuth client, such as code running in a browser or an app on a phone, that cannot keep a credential secret because the people using it can inspect it. It relies on protections such as PKCE instead of a client secret. the server should not approve repeat requests automatically unless it can confirm the client's identity some other way, as Native applications explained. When the printer asks for something new, such as photos.share, the server asks Ava about the new scope rather than treating the old approval as covering it. And the record is what Ava sees on her account's connected applications page: each application, what it can access, when she approved it, when it was last used, and a way to remove it.
Removing a grant has to have an effect, and Token revocation followed how far that effect reaches: refresh tokens stop working at once, while access tokens already issued may keep working until they expire at APIs that validate them locally. A connected applications page that says so plainly is more honest than one that implies access stopped the moment she selected Remove.
The API checks the signature itself
- Refresh token
- Stops at once
- Next refresh
- invalid_grant
- Access token already issued
- Works until it expires
Access ends at expiry
The API introspects each token
- Refresh token
- Stops at once
- Next refresh
- invalid_grant
- Access token already issued
- Refused at its next request
Access ends now
A connected applications page that says so plainly is more honest than one that implies access stopped the moment she selected Remove.
Issuing codes, tokens, and keys
The rules for codes and refresh tokens were set out where each was introduced, from single-use codes to refresh tokens stored as hashes in families. Access tokens depend on their format: reference tokens need a lookup record for introspectionA way for an API to ask the authorization server what a token means: whether it is still active and what access it carries. APIs need it when a token is a random string that only the authorization server can interpret., while self-contained JWTs need nothing stored but each carries the signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. of a key the server must protect.
Running the server adds the decisions those lessons left as policy. RFC 6749 recommends that a code live no more than ten minutes, and many servers use far less. Access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in. lifetimes, the idle and absolute lifetimes of refresh token families, and which clients receive refresh tokens at all are settings the photo service chooses for each client and scope, and reviews when a client's needs change. The printer's ten-minute access tokens and the 400-day idle lifetime that keeps the yearly calendar connected are both choices of this kind.
The signing key is the most valuable secret the authorization server holds. Anyone with it can mint tokens that every APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests. will accept. It belongs in a key management service or hardware module that signs without releasing the key, with access limited to the service that issues tokens. Rotation follows the overlap described in Storing and using keys. The authorization server's part is to plan it around verifiers it does not control. All key names and dates in this schedule are fictional:
| Date | Published in the key set | Signing with |
|---|---|---|
| 2026-12-01 | photos-2026-09, photos-2027-01 | photos-2026-09 |
| 2027-01-04 | photos-2026-09, photos-2027-01 | photos-2027-01 |
| 2027-01-11 | photos-2027-01 | photos-2027-01 |
The new key appears a month before it signs anything, so even an API that refreshes its cached key setA JSON document, published at a fixed HTTPS address, that lists an issuer's current public keys so others can verify its signatures. It never contains private keys. rarely has plenty of time to see it. The old key stays published for a week after the switch, far longer than its ten-minute tokens need. Its private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner. signs nothing during that week, so the extra margin costs little.
The server also publishes what clients and APIs need to find all this: its metadata document, its key set, and its introspection and revocationCancelling a credential, token, certificate, or authenticator before it would expire, so that it is no longer accepted. Whether every copy stops working at once depends on how services check it. endpoints. These are production services in their own right. An API that introspects every request depends on the introspection endpoint as much as on its own database, and a metadata document that lists the wrong endpoint misconfigures every client that trusts it.
Watching, limiting, and ending access
An authorization server sees every attempt to obtain access, which makes its audit log the place where investigations start. Useful events include client registrations and changes, grants created and removed, tokens issued by client and grant type, failed client authentication, codes presented twice, refresh token reuse, key rotations, and administrative actions. Each needs a time, the client, the person where there is one, the outcome, and a reason. None should contain a code, token, secret, or password, so that reading the log never hands anyone a working credential.
The same endpoints need limits. The token endpoint limits failed authentication attempts per client, so a known client ID cannot be paired with guessed secrets at speed. The device verification page limits user code guesses, as Device authorization described. Sign-in pages limit password attempts, and an open registration endpoint limits how quickly new clients can appear. A limit that is reached should raise an alert as well as reject requests, because a spike is often the first visible sign of an attack.
Finally, the server ends access when circumstances change. Refresh tokens and rotation listed the events that should end a token family or a whole grant, from a password reset to a suspended client. Operating the server means making sure those events actually reach the grant records. The account system that resets passwords, the support tools that suspend clients, and the process for handling a leaked credential each need a way to say which grants to end, and each revocation belongs in the audit log with its reason. Unless the two services have arranged a separate way to send such events, the printer learns about it at its next refresh, when it receives invalid_grant and asks Ava to reconnect.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Operate your lab tenant as an authorization server for a dayReview the client registry with its last use and owners, suspend a client, watch stored approvals drive consent and the connected applications page, plan a key rotation, and read the audit trail.