Skip to content

Fix Microsoft OIDC authentication failure#918

Open
gearnode wants to merge 1 commit intomainfrom
gearnode/fix-microsoft-oidc
Open

Fix Microsoft OIDC authentication failure#918
gearnode wants to merge 1 commit intomainfrom
gearnode/fix-microsoft-oidc

Conversation

@gearnode
Copy link
Contributor

@gearnode gearnode commented Mar 23, 2026

Summary

  • Set AuthStyle: oauth2.AuthStyleInParams on the Microsoft OAuth2 endpoint
  • Without this, the oauth2 library auto-detects the auth style by first trying Basic auth (header), which Microsoft rejects — and since PKCE authorization codes are single-use, the retry with credentials in the POST body fails with the already-consumed code
  • This matches the official golang.org/x/oauth2/microsoft package behavior

Test plan

  • Sign in with Microsoft OIDC and verify authentication succeeds
  • Sign in with Google OIDC and verify it still works

Summary by cubic

Fix Microsoft OIDC sign-in by sending client credentials in the token request body. This prevents PKCE code reuse failures caused by oauth2 auto-detect trying Basic auth.

  • Bug Fixes
    • Set AuthStyle: oauth2.AuthStyleInParams for the Microsoft OAuth2 endpoint to match golang.org/x/oauth2/microsoft.

Written for commit 3879641. Summary will update on new commits.

Without an explicit AuthStyle, the oauth2 library uses
auto-detection which tries Basic auth first. Microsoft
rejects this, and since PKCE codes are single-use, the
retry with the correct style fails.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@gearnode gearnode added the status: needs-review Ready for review by maintainers label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs-review Ready for review by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant