OAuth2\OAuth2::grantAccessTokenClientCredentials PHP Method

grantAccessTokenClientCredentials() protected method

protected grantAccessTokenClientCredentials ( OAuth2\Model\IOAuth2Client $client, array $input, array $clientCredentials ) : array | boolean
$client OAuth2\Model\IOAuth2Client
$input array
$clientCredentials array
return array | boolean
    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);
        }
        if (!is_array($stored)) {
            $stored = array();
        }
        $stored += array('issue_refresh_token' => false);
        return $stored;
    }