We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, in a client credentials flow the scope parameter is optional and the current implementation send the parameter anyway:
public function requestClientCredentialsToken() { $token_endpoint = $this->getProviderConfigValue('token_endpoint'); $headers = []; $grant_type = 'client_credentials'; $post_data = [ 'grant_type' => $grant_type, 'client_id' => $this->clientID, 'client_secret' => $this->clientSecret, 'scope' => implode(' ', $this->scopes) ]; // Convert token params to string format $post_params = http_build_query($post_data, '', '&', $this->encType); return json_decode($this->fetchURL($token_endpoint, $post_params, $headers)); }
In Keycloak this behaviour is not expected and return an error of invalid scopes.
To solve the error I need to specify the scope openid, but the right way would be the following implementation:
openid
public function requestClientCredentialsToken() { $token_endpoint = $this->getProviderConfigValue('token_endpoint'); $headers = []; $grant_type = 'client_credentials'; $post_data = [ 'grant_type' => $grant_type, 'client_id' => $this->clientID, 'client_secret' => $this->clientSecret ]; if($this->scopes){ $post_data['scope']=implode(' ', $this->scopes); } // Convert token params to string format $post_params = http_build_query($post_data, '', '&', $this->encType); return json_decode($this->fetchURL($token_endpoint, $post_params, $headers)); }
The text was updated successfully, but these errors were encountered:
According to the RFC 6749 (OAuth 2.0) the scope is indeed optional. I think this is a good solution.
Sorry, something went wrong.
fix(jumbojett#392): avoid to send optional empty scope in a client cr…
8675a52
…edentials grant
I created a pull request which need approval by maintainers.
fea9484
No branches or pull requests
Hi, in a client credentials flow the scope parameter is optional and the current implementation send the parameter anyway:
In Keycloak this behaviour is not expected and return an error of invalid scopes.
To solve the error I need to specify the scope
openid
, but the right way would be the following implementation:The text was updated successfully, but these errors were encountered: