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

Header in requestClientCredentialsToken #206

Closed
saskiaschild opened this issue Mar 31, 2020 · 1 comment
Closed

Header in requestClientCredentialsToken #206

saskiaschild opened this issue Mar 31, 2020 · 1 comment

Comments

@saskiaschild
Copy link

In requestClientCredentialsToken the headers are set to an empty array. Since the documentation of OAuth and OpenId Connect says that HTTP Basic Authentication is needed, there should be the at least the basic header in there.

public function requestClientCredentialsToken() {
   $token_endpoint = $this->getProviderConfigValue('token_endpoint');

   $headers = [
      'Authorization: Basic ' . base64_encode(urlencode($this->clientID) . ':' . urlencode($this->clientSecret))
   ];

   $grant_type = 'client_credentials';

   $post_data = array(
      '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, null, '&', $this->enc_type);

   return json_decode($this->fetchURL($token_endpoint, $post_params, $headers));
}

Would be nice to have the header there (or at least the possibility to set headers via method parameters).

@azmeuk
Copy link
Collaborator

azmeuk commented Nov 21, 2021

Fixed by #271

@azmeuk azmeuk closed this as completed Nov 21, 2021
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

2 participants