Skip to content

fix(kanidm): enable PKCE using intended mechanism - #1488

Merged
atymic merged 2 commits into
SocialiteProviders:masterfrom
haydenmc:fix-kanidm-pkce
Sep 11, 2026
Merged

atymic merged 2 commits into
SocialiteProviders:masterfrom
haydenmc:fix-kanidm-pkce

Conversation

@haydenmc

Copy link
Copy Markdown
Contributor

A previous change (#1421) enabled PKCE for Kanidm by turning it on in the getBaseUrl() function.

This can cause authentication to fail if usesPKCE() is called before getBaseUrl(), which is the case when using Kanidm with Lychee, resulting in a 500 error during the auth flow, and this error in Kanidm logs:

kanidm-1       | 6db89809-5bcc-4469-bd6a-54d717ec98d1 INFO     ┕━ handle_oauth2_token_exchange [ 123µs | 54.21% ]
kanidm-1       | 6db89809-5bcc-4469-bd6a-54d717ec98d1 INFO        ┕━ i [info]: PKCE code verification failed - code challenge is present, but no verifier was provided | event_tag_id: 10

AbstractProvider.php is meant to populate code_verifier here but doesn't, due to usesPKCE() returning false.

This change adds the explicit function override for usesPKCE(), which will properly indicate to socialite that PKCE is enabled.

@atymic atymic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a test please?

@haydenmc

Copy link
Copy Markdown
Contributor Author

Added tests inspired by some from another provider (Vipps) and confirmed they are passing locally.

Please let me know if you need anything else. Thank you!

@atymic
atymic merged commit 781a733 into SocialiteProviders:master Sep 11, 2026
3 checks passed
@atymic atymic added the release:minor Release a new minor version for changed providers label Sep 11, 2026
@haydenmc
haydenmc deleted the fix-kanidm-pkce branch September 11, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:minor Release a new minor version for changed providers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants