"error": "invalid_grant", "error_description": "Bad Request" - PullRequest
0 голосов
/ 14 апреля 2020

У меня ошибка при аутентификации в API менеджера ставок DoubleClick. Сообщение об ошибке:

{ "error": "invalid_grant", "error_description": "Bad Request" }

Это мой код, который у меня есть в PHP. Любая помощь будет оценена

`


    $code = $_GET['code'];
    static::$Request = curl_init();
    curl_setopt(static::$Request,CURLOPT_URL,"https://www.googleapis.com/oauth2/v4/token");
    curl_setopt(static::$Request, CURLOPT_POST, 1 );
    curl_setopt(static::$Request,CURLOPT_POSTFIELDS,"client_id=".urlencode(static::$client->getClientId())."&client_secret=".urlencode(static::$client->getClientSecret())."&code=".$code."&grant_type=authorization_code&redirect_uri=".urlencode('http://localhost/dv360.omdata.co/index.php'));
    curl_setopt(static::$Request, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    curl_setopt(static::$Request, CURLOPT_RETURNTRANSFER, true);
    static::$Response = curl_exec(static::$Request);
    curl_close(static::$Request);
    print_r(static::$Response);

`

...