diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php index 6aa80b17..e27ebfa0 100644 --- a/src/OpenIDConnectClient.php +++ b/src/OpenIDConnectClient.php @@ -810,9 +810,12 @@ public function requestClientCredentialsToken() { $post_data = [ 'grant_type' => $grant_type, 'client_id' => $this->clientID, - 'client_secret' => $this->clientSecret, - 'scope' => implode(' ', $this->scopes) + '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);