Skip to content

fix: send client_id on the token request when no auth method is set - #161

Merged
ikawalec merged 2 commits into
masterfrom
fix/device-flow-client-id
Sep 23, 2026
Merged

ikawalec merged 2 commits into
masterfrom
fix/device-flow-client-id

Conversation

@ikawalec

Copy link
Copy Markdown
Contributor

Fixes #160

Device flow leaves AuthMethod empty (PromptForClientConfig only asks for it on the code/client_credentials/refresh/password/jwt-bearer grants), and AuthenticateClient switches on AuthMethod — so with no auth method the token request carried only grant_type and device_code, and the server answered invalid_client.

Fixing it in AuthenticateClient covers every caller (token, PAR), not just device flow.

Before:

POST /token  body=device_code=DC123&grant_type=urn:ietf:params:oauth:grant-type:device_code

After:

POST /token  body=client_id=my-client&device_code=DC123&grant_type=urn:ietf:params:oauth:grant-type:device_code

@ikawalec
ikawalec marked this pull request as ready for review September 10, 2026 07:03
@holowinski
holowinski self-requested a review September 23, 2026 16:21
@ikawalec
ikawalec enabled auto-merge September 23, 2026 16:22
…ent-id

# Conflicts:
#	internal/oauth2/request_test.go
@ikawalec
ikawalec merged commit ddf1a12 into master Sep 23, 2026
3 checks passed
@ikawalec
ikawalec deleted the fix/device-flow-client-id branch September 23, 2026 16:28
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.

Device flow doesn't send client_id and doesn't work without client_secret

3 participants