Skip to content

Only require PKCE for the authorization code exchange - #582

Merged
maennchen merged 1 commit into
erlef:mainfrom
ARAYN7011:fix/pkce-only-for-code-exchange
Nov 20, 2026
Merged

maennchen merged 1 commit into
erlef:mainfrom
ARAYN7011:fix/pkce-only-for-code-exchange

Conversation

@ARAYN7011

Copy link
Copy Markdown
Contributor

Fixes #581

require_pkce (set by fapi2_security_profile) was enforced for every token request, so refresh/3 and client_credentials/2 failed with pkce_verifier_required. Per RFC 7636 and FAPI 2.0 §5.3.2.2, PKCE only binds the authorization code to token exchange, as @maennchen noted on the issue. retrieve_a_token/5 now only adds/enforces the PKCE verifier when grant_type is authorization_code.

Test plan

  • New refresh_and_client_credentials_ignore_require_pkce_test in oidcc_token_test; fails before the change, passes after.
  • rebar3 eunit --module=oidcc_token_test (44 tests, 0 failures), rebar3 fmt --check, rebar3 lint clean. rebar3 dialyzer crashed in rebar_core on this sandbox while updating the PLT, so it was not run.

AI disclosure: this change was prepared with Claude (Claude Code).

fapi2_security_profile sets require_pkce, but add_pkce_verifier was applied
to every token request, so refresh and client_credentials failed with
pkce_verifier_required. RFC 7636 only binds the authorization code grant.

Fixes erlef#581

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@maennchen
maennchen merged commit ea68542 into erlef:main Nov 20, 2026
28 checks passed
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.

refresh_token fails with pkce_verifier_required under fapi2_security_profile

2 participants