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

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error #2596

Closed
arvindpundir opened this issue Feb 25, 2020 · 3 comments
Closed

Comments

@arvindpundir
Copy link

I am trying to get member details via rest API in php for GRS storefront, I dont know how to use AuthData (), class, why docs of guzzle to hard to understand

id = 'EFDEMO'; $auth->token = 'BlC8CKxadtiOwdq0S019afV8bczn0Kh2'; //$auth->password = 'EFDEMO'; // not needed if using token $response = $client->get($url.'/getMemberAccount', array( 'auth' => base64_encode(json_encode($auth)), 'verify' => false, 'timeout' => 30 // seconds )); $jsonData = json_decode($response->getBody(), true); echo $jsonData;
@arvindpundir
Copy link
Author

I am using API from this ,https://www.globalrewardsolutions.com/

@massimomarazzi
Copy link

massimomarazzi commented Feb 26, 2020

Hi, same here,
Php 7.2.28 on apache

Composer:

 "require": {
        "guzzlehttp/guzzle": "^6.5.2"
    }

Code:

$access_token_uri = "https://api.instagram.com/oauth/access_token";
		$form_params = [
			'form_params'=> [
				'client_secret' => 'client_secret',
				'client_id' => 'XXXXXXXXXX',
				'grant_type' => 'authorization_code',
				'redirect_uri' => HOME_URL . '/oauth-ok/',
				'code' => $auth_code
			],
			'debug' => DEBUG
		];
		$clientPost = new GuzzleHttp\Client();
		$response_short_token = $clientPost->request('POST', $access_token_uri, $form_params );

Error Log:

PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://api.instagram.com/oauth/access_token resulted in a `400 Bad Request response:
{"error_type": "OAuthException", "code": 400, "error_message": "Error validating verification code. Please make sure you (truncated...)
 in /vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113

Stack trace:
#0 //vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Res in /vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

@gmponos
Copy link
Member

gmponos commented May 20, 2020

Hi,

We use GitHub issues only to discuss bugs and new features. For this kind of questions please use other support channels like stackoverflow.

https://stackoverflow.com/questions/tagged/guzzle

Never the less if you have any suggestion to improve our docs feel free to submit a PR. Contributions are welcome.

@gmponos gmponos closed this as completed May 20, 2020
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

3 participants