What you'll learn: By the end of this lesson you will be able to name the roles an authorization server and a resource server play, choose between the authorization code grant with PKCE and the client credentials grant, say what a token endpoint must check before it issues a token, explain what OpenID Connect adds and why an ID Token must never be sent to an API, configure a Spring Security resource server so that it checks signature, algorithm, issuer, audience, token type and expiry, and tell a 401 from a 403 and a scope from permission to touch one record. A Spring Boot lab with a clearly named stand-in authorization server lets you watch each check refuse its attack.
A valet key opens the car door and starts the engine, but not the boot or the glovebox, and it was cut for one car. The attendant never sees your house keys. That is OAuth 2.0: instead of handing an application your password, the system hands it a limited, short-lived key made for one purpose. Two properties matter all through this lesson: the key is limited (a scope) and it is made for one car (an audience). A key that opens every car in the car park is the failure this lesson teaches you to prevent.
This is the back-end view. The browser view, where a single-page app builds state, nonce and the PKCE values and handles the redirect, is in OAuth 2.0, OIDC and PKCE in Single-Page Apps, with JWTs, single sign-on and the session lifecycle and token storage and secure cookies. This lesson does not repeat them: it covers who issues, who validates, what is checked and what a refusal looks like. The prerequisite is Authentication vs Authorization, Sessions vs Tokens. The JWT's own structure and pitfalls are the next lesson, JWT: Structure and Pitfalls.
Verified with Spring Boot 4.1.2, Spring Security 7.1.2, Java 25, RFC 6749, 6750, 7636, 9068 and 9700, OpenID Connect Core 1.0 and the Spring Security reference, on 2026-12-01.
The core idea
- OAuth 2.0 delegates access; OpenID Connect adds who signed in. The authorization server authenticates people and clients and issues tokens. A resource server (your API) only checks tokens and enforces what they allow. OpenID Connect is described by its specification as "a simple identity layer on top of the OAuth 2.0 protocol".
- A token is useful only if the API checks it completely. Valid signature is one check of several. The algorithm, the issuer, the audience, the token type, the expiry and the scope each stop a different attack, and a check left out is a door left open.
- A scope says what kind of call is allowed, never which record. The question "may this caller touch order 7?" is answered by your own code on the server, with the identity in the token.
The roles, on the server
RFC 6749 defines four roles: the resource owner (the user who can grant access), the resource server (hosts the protected data, accepts access tokens), the client (the application asking) and the authorization server (authenticates the owner and issues tokens). A back end is usually the last two: either the authorization server (or a product that is), or a resource server that trusts one.
Figure 1. Who issues and who checks. How to read this: only the authorization server signs people in and mints tokens. The resource server never sees a password; it gets the token the client presents and decides whether to believe it.
RFC 6749 also splits clients into confidential (can keep credentials secret, like a server-side service) and public (cannot, like a single-page or mobile app that ships to the user). The rest of the lesson depends on that split.
Grant types: how a client gets a token
A grant is the way a client obtains a token. RFC 6749 names four: authorization code, implicit, resource owner password credentials and client credentials. The security best current practice, RFC 9700, narrows what to use today:
- Authorization code, with PKCE. A user is present. The client sends the user to the authorization server, gets a one-time code in the redirect and exchanges it at the token endpoint. RFC 9700: public clients MUST use PKCE, it is RECOMMENDED for confidential clients, authorization servers MUST support it, and clients SHOULD use a method that does not expose the verifier, which today means S256.
- Client credentials. No user; a service authenticates as itself. RFC 6749: only confidential clients, and a refresh token SHOULD NOT be included.
- Implicit. RFC 9700: clients SHOULD NOT use it, because it returns the access token in the redirect; use the
coderesponse type. - Resource owner password credentials. RFC 9700: MUST NOT be used.
Figure 2. Which grant for which caller
How to read this: the first question is whether a person is involved. The dotted line marks the two grants current advice rules out.
What the token endpoint checks
The authorization code is a ticket. The token endpoint must make sure it is used once, by the party it was issued to, for the purpose it was issued for.
Figure 3. Exchanging a code, with the server's checks
redirect_uri, code_verifier S->>S: remove the code (single use) S->>S: same client? same redirect_uri? S->>S: S256(verifier) equals stored challenge? alt any check fails S-->>C: 400 invalid_grant else all pass S->>S: sign access token (and ID Token if openid) S-->>C: 200 access_token, expires_in, scope end
How to read this: every branch that fails ends in the same error, invalid_grant, so an attacker learns nothing about which check failed. A failed attempt still burns the code.
The specifications behind each step: RFC 6749 says a code MUST NOT be used more than once, recommends a maximum lifetime of 10 minutes, requires the token request's redirect_uri to be identical to the authorization request's, and says that if a code is used twice the server SHOULD try to revoke tokens already issued from it. RFC 7636 defines S256 as BASE64URL-ENCODE(SHA256(ASCII(code_verifier))), compared with the stored challenge, with invalid_grant on a mismatch. RFC 9700 requires exact string matching of redirect URIs. In the lab, the exchange is this:
// remove() makes the code single-use: even a failed attempt burns it (RFC 6749 section 4.1.2, RFC 9700).
PendingCode pending = form.get("code") == null ? null : codes.remove(form.get("code"));
if (pending == null) {
throw new OAuthException("invalid_grant", "unknown, expired or already used code");
}
if (!pending.clientId().equals(form.get("client_id"))) {
throw new OAuthException("invalid_grant", "code was issued to another client");
}
if (!pending.redirectUri().equals(form.get("redirect_uri"))) {
throw new OAuthException("invalid_grant", "redirect_uri differs from the authorization request");
}
String verifier = form.get("code_verifier");
if (verifier == null || !constantTimeEquals(s256(verifier), pending.codeChallenge())) {
throw new OAuthException("invalid_grant", "code_verifier does not match the code_challenge");
}
Errors come from a fixed list in RFC 6749 section 5.2: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type and invalid_scope. A response that carries tokens MUST send Cache-Control: no-store, and the endpoint MUST be reached over TLS. A real server also authenticates confidential clients here; RFC 9700 recommends asymmetric client authentication where feasible, and the lab uses a shared secret only because it is short.
Three tokens, three audiences
OAuth and OpenID Connect hand out different tokens for different readers, and most confusion comes from mixing them up.
| Token | Read by | Purpose | Its aud |
|---|---|---|---|
| Access token | The resource server | Prove the client may call this API, with these scopes | The API |
| ID Token | The client | Tell the client who signed in | The client's client_id |
| Refresh token | The authorization server only | Get a new access token | Not applicable |
RFC 6749 says access tokens are "credentials used to access protected resources" and refresh tokens are for authorization servers, not resource servers. OpenID Connect Core says the ID Token is a JWT with required claims iss, sub, aud, exp and iat, that aud must include the client's client_id, and that sub is a "locally unique and never reassigned identifier within the Issuer for the End-User": key user records on sub, not on an email address. A request for identity includes the scope openid (without it, Core says, behaviour is "entirely unspecified"), and a nonce in the request must come back unchanged in the ID Token.
RFC 9068 profiles JWT access tokens: header typ at+jwt, required claims iss, exp, aud, sub, client_id, iat and jti, and for a grant with no user sub identifies the client. The lab's tokens follow it. Scenario 1 prints both: the access token has aud=[https://api.shop.example] and typ=at+jwt; the ID Token has aud=[dashboard] and typ=JWT. Different documents for different readers, signed by the same key.
The resource server: believing a token
Two ways exist for an API to decide whether a token is good. Spring Security supports both, and its reference lists them as JWT and opaque tokens.
| Self-contained JWT, checked locally | Opaque token, introspected | |
|---|---|---|
| How the API decides | Verifies the signature and claims itself | Asks the authorization server (RFC 7662) |
| Cost per request | CPU, no network call | A network call, or a cache of it |
| Revocation | Not seen until exp unless the API looks something up |
The authorization server's answer is current |
| Fits | Many APIs, high volume, short lifetimes | Cases where cutting access fast matters |
RFC 7662 describes introspection as protected resources querying the authorization server; the response member active is "a boolean indicator of whether or not the presented token is currently active", and a cached answer creates a window in which a revoked token still works. Spring's reference says introspection "can be handy when revocation is a requirement". The next lesson treats JWT mechanics, key rotation and revocation; here the point is the choice.
For JWTs, the checks come in a fixed order, because nothing in the payload can be trusted until the signature has passed.
Figure 4. What a resource server checks, in order
How to read this: the first four decisions are authentication of the token and end in 401. The last two are authorization and end in 403. The first group is about whether to believe the token; the second is about what to let it do.
The status codes come from RFC 6750. A resource server MUST send WWW-Authenticate with the Bearer scheme when a request lacks credentials or the token is not sufficient. invalid_token goes with 401 (expired, revoked, malformed or otherwise invalid), insufficient_scope with 403, and a request with no authentication information at all SHOULD get no error code. The lab reproduces each.
Here is the decoder the lab's API uses, written out because the framework's defaults are not the whole list: in Spring's reference the default with a configured issuer verifies iss, exp and nbf, the default trusted algorithm is only RS256, and the audience check is something you add. Calling setJwtValidator installs the validator you pass in place of the decoder's default one (the reference's audience example composes the default validators with the audience validator for that reason), so the lab lists every check.
NimbusJwtDecoder decoder = NimbusJwtDecoder.withPublicKey(authorizationServer.publicKey())
.signatureAlgorithm(SignatureAlgorithm.RS256)
.build();
JwtTimestampValidator timestamps = new JwtTimestampValidator(Duration.ofSeconds(60));
timestamps.setClock(clock);
decoder.setJwtValidator(new DelegatingOAuth2TokenValidator<>(
timestamps,
new JwtIssuerValidator(StandInAuthorizationServer.ISSUER),
new JwtClaimValidator<List<String>>(JwtClaimNames.AUD,
aud -> aud != null && aud.contains(StandInAuthorizationServer.API_AUDIENCE)),
new AccessTokenTypeValidator()));
The same class turns scopes into URL rules. Spring maps each scope in the scope (or scp) claim to an authority with the prefix SCOPE_, so the scope orders:read is the authority SCOPE_orders:read:
.authorizeHttpRequests(auth -> auth
.requestMatchers(HttpMethod.GET, "/orders/**").hasAuthority("SCOPE_orders:read")
.requestMatchers(HttpMethod.POST, "/orders").hasAuthority("SCOPE_orders:write")
.anyRequest().authenticated())
.oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()))
Scope, audience and the record
Scope. RFC 6749 defines scope as a list of space-delimited, case-sensitive strings and says that if the issued scope differs from the request the server MUST say so. The lab's reporting job asks for orders:read orders:write, is granted orders:read, and the response says so. Design scopes around actions on a kind of resource, not around people.
Audience. RFC 9700 says access tokens SHOULD be audience-restricted to a specific resource server and that resource servers MUST refuse requests when the token was not meant for them. RFC 9068 adds that authorization servers must use a distinct identifier for aud of access tokens to prevent cross-JWT confusion. An API that checks the signature and the issuer but not aud will accept a token issued for any other API of the same issuer.
The record. Neither scope nor audience says whether this caller may read this order. The lab's controller does that, with the subject from the token:
if (!owner.equals(jwt.getSubject())) {
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "not your order");
}
The front-end lesson on authentication vs authorization in the UI gives the same rule from the other side: the server enforces, the UI only reflects. Roles, attributes and relationships for deciding it come in later lessons of this module.
Bearer tokens and their handling
RFC 6750 defines a bearer token as one that any party in possession of can use, with no proof of key possession. So the token goes in the Authorization header (the client SHOULD use it, the server MUST support it), not in a URL, TLS is mandatory, and the token's lifetime MUST be limited; short-lived tokens (one hour or less) reduce the damage of a leak. In the lab a token sent as ?access_token= is ignored: the API answers as if none were sent. RFC 9700 says servers SHOULD sender-constrain access tokens, for example with mutual TLS (RFC 8705) or DPoP (RFC 9449), so a stolen token cannot be replayed without the key; this lesson names those and does not implement them.
Three illustrations
Illustration 1 (minimal example) is the lab below. Illustration 2 (realistic example) is ShopStream splitting its orders and billing APIs, in "In practice". Illustration 3 (failure case) is a token issued for one API and presented to another: correctly signed, right issuer, not expired, still wrong, because only aud says who it was for. In the lab the Orders API refuses a token with aud=https://billing.example, and the ID Token too.
The other side of this topic
The browser side of the same exchange builds state, nonce and the PKCE verifier, handles the redirect and decides where tokens live. Read OAuth 2.0, OIDC and PKCE in Single-Page Apps, JWTs, single sign-on and the session lifecycle, Token storage and secure cookies and Authentication flows end to end. The front-end labs oauth-pkce-model and token-session-lifecycle model the client's checks; this lesson's lab is their server-side partner.
Build it: a resource server and a stand-in authorization server
Goal: see the token endpoint refuse every wrong exchange and a real Spring Security resource server refuse every wrong token. Not a real identity provider: StandInAuthorizationServer is written for teaching, keeps everything in memory, has no user database, consent screen, refresh tokens or revocation, and generates its RSA key pair at start-up. No Docker and no external provider are involved. The API is a Spring Boot application with the real filter chain, called through MockMvc: no network, no port.
Setup. From the repository:
cd examples/spring-labs
./gradlew :labs:oauth-resource-server:test
It runs 5 tests: four behaviour tests and one that compares the report below with examples/spring-labs/golden/oauth-resource-server.txt. A MutableClock moved by hand makes expiry exact, and nothing random (keys, codes, jti) is printed. The code is in examples/spring-labs/labs/oauth-resource-server/.
Scenarios 1 and 2: the code grant and every wrong exchange. The first exchange succeeds and prints both tokens. Then each wrong exchange is tried against a fresh code.
Expected output, captured from a real run (Spring Boot 4.1.2, Spring Security 7.1.2, Java 25, 2026-12-01):
== 1. Authorization code grant with PKCE, at the stand-in authorization server
client dashboard (public, no secret) asks for scope "openid orders:read"; the user alice signs in
code_verifier length 49, code_challenge (S256) = 5NJNWkCV772f0pnObRv4Msd1WPR0gfp9eGDaFQc-xhA
token response: token_type=Bearer expires_in=600 scope="openid orders:read" id_token=yes
access token:
header {alg=RS256, kid=key-1, typ=at+jwt}
payload {aud=[https://api.shop.example], client_id=dashboard, exp=2026-12-01T09:10:00Z, iat=2026-12-01T09:00:00Z, iss=https://id.example, scope=openid orders:read, sub=alice}
ID Token (for the client, not for the API):
header {alg=RS256, kid=key-1, typ=JWT}
payload {aud=[dashboard], exp=2026-12-01T09:10:00Z, iat=2026-12-01T09:00:00Z, iss=https://id.example, nonce=n-demo, sub=alice}
== 2. The token endpoint refuses every wrong exchange (RFC 6749 section 5.2 error codes)
wrong code_verifier: invalid_grant
then the right verifier with the same code: invalid_grant (a failed attempt burns the code)
a code used a second time: invalid_grant
redirect_uri that differs by one trailing slash: invalid_grant
authorization request with an unregistered redirect_uri: invalid_request
authorization request without a code_challenge: invalid_request
grant_type=password: unsupported_grant_type
The one-slash difference in the redirect URI is refused because the comparison is exact, as RFC 9700 requires. The stand-in omits things a real server must do, for example revoking tokens already issued when a code is replayed.
Scenario 3: a service with no user. The reporting job uses client credentials. Its token has no ID Token, its sub is the client, and scope is narrowed to what the client may have.
Expected output, captured from a real run (the same run):
== 3. Client credentials grant: a service with no user (the reporting job)
asked for "orders:read orders:write", granted "orders:read" id_token=no
header {alg=RS256, kid=key-1, typ=at+jwt}
payload {aud=[https://api.shop.example], client_id=reporting-job, exp=2026-12-01T09:10:00Z, iat=2026-12-01T09:00:00Z, iss=https://id.example, scope=orders:read, sub=reporting-job}
wrong client secret: invalid_client
only a scope the client may not have: invalid_scope
a public client asking for client_credentials: invalid_client
Scenarios 4 and 5: the API. The first block is the happy paths and the scope and record rules; the second is eight cases of a token or request that must not get through, each wrong in exactly one way. The WWW-Authenticate challenge for a request with no token is printed in full once, and the others show the RFC 6750 error code and Spring's description.
Expected output, captured from a real run (the same run):
== 4. The resource server (Spring Boot, real filter chain, called through MockMvc)
no token: GET /orders/o-1 -> 401 WWW-Authenticate: Bearer resource_metadata="http://localhost/.well-known/oauth-protected-resource"
alice, scope orders:read: GET /orders/o-1 (hers) -> 200
alice, scope orders:read: GET /orders/o-2 (bob's) -> 403
alice, scope orders:read: POST /orders -> 403 error=insufficient_scope "The request requires higher privileges than provided by the access token."
alice, scope orders:write: POST /orders -> 200
reporting-job token: GET /whoami -> 200 {"authorities":["FACTOR_BEARER","SCOPE_orders:read"],"sub":"reporting-job"}
== 5. Tokens the resource server must refuse (each one is wrong in exactly one way)
signed by another key: GET /orders/o-1 -> 401 error=invalid_token "Signed JWT rejected: Invalid signature"
payload edited after signing: GET /orders/o-1 -> 401 error=invalid_token "Signed JWT rejected: Invalid signature"
algorithm none: GET /orders/o-1 -> 401 error=invalid_token "Unsupported algorithm of none"
another API as audience: GET /orders/o-1 -> 401 error=invalid_token "The aud claim is not valid"
another issuer: GET /orders/o-1 -> 401 error=invalid_token "The iss claim is not valid"
typ is JWT, not at+jwt (audience otherwise right): GET /orders/o-1 -> 401 error=invalid_token "the token is not a JWT access token (typ must be at+jwt)"
the ID Token instead of the access token: GET /orders/o-1 -> 401 error=invalid_token "The aud claim is not valid"
access token in the query string: GET /orders/o-1?access_token=... -> 401 (challenge without an error code)
Alice's read-only token reaches her own order (200), is refused on bob's order by the controller (403, a record rule) and on POST /orders by the filter chain (403, a scope rule with insufficient_scope). The whoami output shows SCOPE_orders:read as the mapped authority, plus an authority named FACTOR_BEARER that this lab does not use. In the second block an edited payload gets the same 401 as a foreign key: the signature covers the payload, so an edited claim cannot be told from a forged one.
Scenario 6: expiry and clock skew. The API allows 60 seconds of skew, which is also what Spring's reference gives as its default. The token's lifetime is 600 seconds.
Expected output, captured from a real run (the same run):
== 6. Expiry and the 60 second clock skew of the API (token lifetime 600 s, clock moved by hand)
59 s after exp: GET /orders/o-1 -> 200
61 s after exp: GET /orders/o-1 -> 401 error=invalid_token "Jwt expired at 2026-12-01T09:10:00Z"
The grace period forgives two machines that disagree about the time and extends every token's life by the same amount. RFC 7519 says implementations MAY allow a small leeway, "usually no more than a few minutes".
Break it. In ResourceServerConfig.jwtDecoder, delete the JwtClaimValidator for aud. The token meant for another API is now accepted (right key, right issuer, not expired), and the behaviour test and the golden comparison fail. The ID Token is still refused, now by the typ check: two independent defences. Restore the line and re-run.
Left out: refresh tokens, revocation, key rotation, sender-constrained tokens, consent and client registration. Rotation and revocation are in the next lesson's lab.
Trade-offs
| Choice | Gain | Cost | Wrong when |
|---|---|---|---|
| Authorization code with PKCE for every interactive client | One flow, no secret in public clients | A redirect round trip, more server state | The caller has no user |
| Client credentials for services | Simple, no redirect | A long-lived secret to protect; no user identity | A user's identity must reach the API |
| JWT access tokens validated locally | No call per request, scales with the number of APIs | Revocation waits for exp; every API must implement every check |
You must cut access within seconds |
| Opaque tokens introspected | Current answer on every check | A network dependency and load on the authorization server | The API must work when the authorization server is down |
| Narrow scopes and one audience per API | A stolen token does little | More scopes to design | Scopes are used as roles for people |
In practice: ShopStream gives each API its own audience
This is an educational scenario on the course's running example, ShopStream; it describes no real company. Every number in it is illustrative.
This is a realistic scenario, not a case history.
The situation
ShopStream's staff dashboard calls an Orders API and a Billing API, and both accept any token from the company's authorization server. A store manager's token should read her store's orders but never reach billing. A nightly reporting job needs read access to orders and nothing else.
Starting architecture
Figure 5. A token that opens both doors. How to read this: the red dashed edge is the problem. Because neither API checks the audience, a token issued for one is accepted by the other.
Options considered
| Option | Behaviour | Risk |
|---|---|---|
| A. One audience for all APIs | Simple to issue | Any API accepts any token |
| B. One audience per API, validated by each | A token is cut for one car | The server must issue per-API audiences |
| C. Opaque tokens, introspected | Each API asks the server | A call per request, a dependency on the server |
The decision
Option B. The authorization server issues access tokens whose aud is the one API they are for, with a short lifetime of 10 minutes (illustrative), and each API validates signature, algorithm, issuer, audience, typ and expiry exactly as in Figure 4. The scopes are orders:read, orders:write and billing:read. The reporting job gets orders:read only. The record rule (a manager sees only her store's orders) is written in the Orders API, not encoded in a scope.
Rollout and verification
Every API gets the same contract test the lab runs: another key, an edited payload, alg: none, the wrong audience, the wrong issuer, the ID Token and an expired token, each expecting 401, plus a read-only token on a write route expecting 403. In production the checks are counts: 401s by error code per API, 403s by route, and accepted tokens by aud.
The 2 a.m. failure
The page reads: the Billing API is serving requests that carry tokens whose audience is the Orders API. A refactor replaced the decoder configuration with one that sets only timestamp and issuer validators, and the audience check went with it. Tests with correct tokens still pass, so nobody noticed. The first check is the aud of a decoded token from the logs (header and payload only). The mitigation is to redeploy the previous configuration; the lasting fix is the contract test above, which fails the build when a check is missing, as "Break it" does.
Architect's notes
- List every check the API relies on. Defaults are a start, and a custom validator replaces them.
- One audience per API, and refuse anything else. A token cut for one resource must open only that one.
- Keep ID Tokens away from APIs. Accept only tokens of the access-token type.
- Keep scopes about actions and object rules in code. Scopes do not know whose order it is.
- Short lifetimes are the default revocation policy. A self-contained token cannot be recalled until it expires unless you add a lookup.
Common mistakes
- Treating a valid signature as a valid request. It proves the issuer, nothing about audience, expiry or scope.
- Accepting an ID Token as an access token. Both are signed by the same key; only
audandtyptell them apart. - Using scopes as ownership.
orders:readdoes not mean "reads any order". - Using the implicit or password grant "for now". Current guidance says not to.
- Matching redirect URIs loosely. Prefix or wildcard matching is how codes reach attacker pages.
- Sending tokens in URLs. They end up in logs, history and referrers.
Key takeaways
- The authorization server issues tokens; the resource server checks them and enforces scope and ownership.
- Use the authorization code grant with PKCE when a user is present and client credentials for a confidential service; do not use implicit or password.
- A token endpoint makes a code single-use, matches the client and the exact redirect URI, and checks the PKCE verifier.
- An access token is for the API, an ID Token is for the client, a refresh token is for the authorization server.
- A resource server checks algorithm and signature, then expiry, issuer, audience and token type, then scope, then the record.
- 401 means "do not believe this token"; 403 means "believed, but not allowed", and
insufficient_scopeis a 403. - Bearer tokens work for whoever holds them: short lifetimes, TLS, and consider sender-constrained tokens.
Practice exercises
Exercise 1 (20 min). For a mobile app, a server-side web app and a nightly job, choose the grant and say which are public clients.
Exercise 2 (45 min). Run the lab. Add a scope orders:cancel and a DELETE /orders/{id} route that needs it, and a scenario showing that a token with only orders:write gets insufficient_scope.
Exercise 3 (1 hour). Run "Break it". Then write the contract test a second API needs so that removing any one validator fails the build.
Related reading
- Authentication vs Authorization, Sessions vs Tokens: the prerequisite, and the choice between sessions and tokens.
- Security for Distributed Systems and ShopStream Stage 10: secure and operate: the threat-model frame, and where sign-in sits in the whole system.
- TLS and HTTPS and Zero trust and least privilege: the transport every bearer token depends on, and why every API checks every token.
- The browser side: OAuth 2.0, OIDC and PKCE in Single-Page Apps, JWTs, single sign-on and the session lifecycle, Token storage and secure cookies and Authentication vs authorization in the UI.
Official documentation
- RFC 6749: The OAuth 2.0 Authorization Framework: roles, grants, the token endpoint and its errors.
- RFC 6750: Bearer Token Usage: the
Authorizationheader,WWW-Authenticateand the error codes. - RFC 7636: Proof Key for Code Exchange: the verifier, the S256 challenge and the server check.
- RFC 9700: Best Current Practice for OAuth 2.0 Security: which grants to use, redirect URIs, audience and sender-constraining.
- RFC 9068: JWT Profile for OAuth 2.0 Access Tokens:
at+jwt, required claims and resource-server validation. - OpenID Connect Core 1.0: the ID Token and its validation.
- Spring Security: OAuth 2.0 Resource Server (JWT) and opaque tokens.