Skip to content

docs(api): use PKCE for ReadMe docs OAuth - #903

Merged
seferturan merged 1 commit into
masterfrom
fix/readme_pkce
Aug 11, 2026
Merged

docs(api): use PKCE for ReadMe docs OAuth#903
seferturan merged 1 commit into
masterfrom
fix/readme_pkce

Conversation

@rectifyer

@rectifyer rectifyer commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The Re-Authorize / Try It OAuth flow on docs.trakt.tv fails with a generic Authorization Error popup after authorizing (refs #878). ReadMe's default authorization code exchange sends the client credentials via HTTP Basic authentication, which auth.trakt.tv does not accept, so the code-for-token exchange 400s and ReadMe surfaces the generic error.

This adds ReadMe's oauth-options to the root x-readme block with usePkce: true. With PKCE enabled, ReadMe replaces the client secret with a code verifier sent in the request body alongside the client_id, which is the exchange shape auth.trakt.tv supports. It also means developer client secrets never route through ReadMe.

Workaround

Until the docs OAuth flow is fully restored, developers testing from the docs must add https://docs.trakt.tv/oauth2-redirect to their app's Redirect URIs at https://app.trakt.tv/settings/apps/api. That is the callback URL ReadMe sends as the redirect_uri for the docs Try It flow, and it currently must be registered on the app for the authorize step to pass.

Testing

  • deno task openapi:generate regenerates the spec with the new oauth-options block
  • deno task openapi:validate, deno fmt --check, and deno lint pass

@rectifyer

Copy link
Copy Markdown
Contributor Author

@seferturan With https://github.com/trakt/trakt-workers/pull/1426 merged and working, this PR should be good to go as well unless you have any issue with enabling this. It seems to be the only way to allow the API docs to authenticate correctly.

@seferturan
seferturan merged commit a8384d4 into master Aug 11, 2026
3 checks passed
@seferturan
seferturan deleted the fix/readme_pkce branch August 11, 2026 12:50
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.

2 participants