Closed numediaweb closed 7 years ago
Why are you using 'set_headers' instead of 'headers' as a key in $options? http://docs.guzzlephp.org/en/latest/request-options.html#headers
Maybe the documentation is not really clear: (@deprecated, will be removed in v6; new: set headers in options)
I will change that sentence if this was the issue.
You are right @florianpreusner the description might be confusing. I fixed it now by setting the correct header:
try {
$options = [
'headers' => [
'Accept' => ['text/html']
],
'form_params' => [
'grant_type' => 'client_credentials',
'client_id' => $this->connectClientId,
'client_secret' => $this->connectClientSecret,
],
];
$response = $this->client->post('/oauth/v2/token?XDEBUG_SESSION_START=19341', $options);
} catch (BadResponseException $e) {
}
dump(json_decode($response->getBody(), true));
This issue can be closed :)
👍
Fixed description: https://github.com/8p/GuzzleBundle/commit/2b6eb8ad5169d573e701075fe90118deb6e076b5
When I call an oAuth v2 end point with CURL it works:
When I use the Guzzle client:
I get this error (from the end point which is also a Symfony application):
Why does it work in CURL and not in Guzzle? I'am using
"eightpoints/guzzle-bundle": "^5.2",
with this config https://github.com/8p/GuzzleBundle/issues/77