Skip to content

chore(other): update docs with refresh token grant type - #20

Merged
DmitryAnansky merged 7 commits into
mainfrom
feat/add-grantType-for-token-refresh
Aug 20, 2026
Merged

chore(other): update docs with refresh token grant type#20
DmitryAnansky merged 7 commits into
mainfrom
feat/add-grantType-for-token-refresh

Conversation

@DmitryAnansky

Copy link
Copy Markdown
Collaborator

Updated docs with refresh-token grant type.

@DmitryAnansky DmitryAnansky self-assigned this Aug 19, 2026
@DmitryAnansky
DmitryAnansky requested review from a team August 19, 2026 14:00
@DmitryAnansky
DmitryAnansky marked this pull request as ready for review August 19, 2026 14:14

@redocly redocly Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cafe AI Review: 🟢 Completed

Redocly Agent has reviewed your changes and found 27 potential issue(s).

Note

Low Risk

These changes update OpenAPI documentation schemas. The risk is minimal as they do not alter application runtime behavior, only API references and potential client generation.

Overview

Updates OpenAPI definitions to detail the refresh_token grant type and clarify OAuth2 registration defaults.

  • Enhances the OAuth2 security scheme description with non-standard behaviors (error formats, token rotation, and non-registrable refresh tokens) and adds a refreshUrl.
  • Adds explicit default values for redirectUris, scopes, and grantTypes to the RegisterClientObject schema.
  • Refines the /oauth2/register endpoint documentation, adds an authorization_code client example, and removes an unused 401 response.

Comment thread openapi/cafe.yaml Outdated
Comment thread openapi/paths/oauth2_register.yaml Outdated
Comment thread openapi/paths/oauth2_register.yaml Outdated
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/components/schemas/RegisterClientObject.yaml Outdated
Comment thread openapi/components/schemas/RegisterClientObject.yaml
Comment thread openapi/components/schemas/RegisterClientObject.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/components/schemas/RegisterClientObject.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/cafe.yaml Outdated
Comment thread openapi/cafe.yaml

Two behaviors do not conform to the specifications:

- **Errors use RFC 9457 problem+json, not RFC 6749 Section 5.2.** Failures return `application/problem+json` with `type`, `title`, `status`, and `instance`. There is no `error` or `error_description` field, so the standard codes (`invalid_grant`, `invalid_client`, `unsupported_grant_type`) never appear — branch on the HTTP status and `title` instead. A refresh token that is expired, already rotated, or unrecognized returns `400` with a `title` of `Refresh token has expired` or `Invalid refresh token`, where a conformant server would return `error: invalid_grant`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Medium

Deviating from the standard OAuth2 error format (error, error_description) in favor of RFC 9457 breaks compatibility with standard OAuth2 client libraries, potentially causing client-side failures or improper error handling in integrated applications.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will review it in other pr and align API codebase with documentation.

Comment thread openapi/cafe.yaml
Comment thread openapi/paths/oauth2_revoke.yaml Outdated
Comment thread openapi/paths/oauth2_register.yaml
Comment thread openapi/cafe.yaml Outdated
Comment thread openapi/paths/oauth2_revoke.yaml Outdated
Comment thread openapi/cafe.yaml
Comment thread openapi/paths/oauth2_revoke.yaml Outdated
Comment thread openapi/components/schemas/RevokeTokenRequest.yaml Outdated
@DmitryAnansky
DmitryAnansky merged commit 4e94c2c into main Aug 20, 2026
5 of 7 checks passed
Comment thread openapi/cafe.yaml

Two are choices the specifications leave to the server:

- **Refresh tokens rotate on every use.** A successful refresh retires the token presented and returns a replacement in `refresh_token`, as RFC 6749 Section 6 permits and the OAuth2 Security Best Current Practice recommends. Store the new value; the old one stops working. Refresh tokens expire 30 days after they are issued, and rotation restarts that window. The authorization code flow returns a refresh token with every access token; the client credentials flow returns none (RFC 6749 Section 4.4.3).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: High

Removing the /oauth2/revoke endpoint prevents clients from invalidating compromised or unused tokens (RFC 7009), extending the window of opportunity for attackers holding stolen access or refresh tokens until they naturally expire.

Comment thread openapi/cafe.yaml
Two behaviors do not conform to the specifications:

- **Errors use RFC 9457 problem+json, not RFC 6749 Section 5.2.** Failures return `application/problem+json` with `type`, `title`, `status`, and `instance`. There is no `error` or `error_description` field, so the standard codes (`invalid_grant`, `invalid_client`, `unsupported_grant_type`) never appear — branch on the HTTP status and `title` instead. A refresh token that is expired, already rotated, or unrecognized returns `400` with a `title` of `Refresh token has expired` or `Invalid refresh token`, where a conformant server would return `error: invalid_grant`.
- **`refresh_token` is not a registrable grant type.** RFC 7591 Section 2 lists it, but `/oauth2/register` accepts only `authorization_code` and `client_credentials` in `grantTypes`. Refreshing requires no registration: holding a refresh token issued to the client is the authorization. A consequence is that refresh capability cannot be disabled per client — every `authorization_code` grant returns a refresh token, so a client intended for a shared or public device cannot be registered without one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Medium

Mandatory refresh_token for all authorization_code grants prevents clients on shared or public devices from opting out of long-lived session persistence, increasing risk of unauthorized access (RFC 6749 Section 4.1.4).

@DmitryAnansky
DmitryAnansky deleted the feat/add-grantType-for-token-refresh branch August 20, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants