protected function grantAccessTokenClientCredentials(IOAuth2Client $client, array $input, array $clientCredentials) { if (!$this->storage instanceof IOAuth2GrantClient) { throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_UNSUPPORTED_GRANT_TYPE); } if (empty($clientCredentials[1])) { throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_CLIENT, 'The client_secret is mandatory for the "client_credentials" grant type'); } $stored = $this->storage->checkClientCredentialsGrant($client, $clientCredentials[1]); if ($stored === FALSE) { throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_GRANT); } return $stored; }