Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device authorization codes request should include client_secret #1041

Open
danielFesenmeyer opened this issue Jun 30, 2022 · 0 comments
Open

Comments

@danielFesenmeyer
Copy link

Currently, the device authorization codes request does not include the client_secret parameter (aka apiKey).

The OAuth 2.0 Device Grant RFC states [1]:

The client authentication requirements of Section 3.2.1 of [RFC6749] apply to requests on this endpoint, which means that confidential clients (those that have established client credentials) authenticate in the same manner as when making requests to the token endpoint...

Hence, the method OAuth20Service#createDeviceAuthorizationCodesRequest(String) should not only set the client_id, but also the client_secret here [2].
Imho the line
request.addParameter(OAuthConstants.CLIENT_ID, getApiKey());
should be replaced with:
api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret());

I observed this issue when trying to test device authorization with a confidential Keycloak client - I got a Keycloak response 401 with body:
{"error":"unauthorized_client","error_description":"Client secret not provided in request"}

[1] https://datatracker.ietf.org/doc/html/rfc8628#section-3.1
[2]

request.addParameter(OAuthConstants.CLIENT_ID, getApiKey());

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

No branches or pull requests

1 participant