Open fverry opened 1 year ago
@fverry, thank you for submitting this PR. Please take a look at the failing tests and fix those. Then, we'll accept this.
I'd note that this is an issue for query
parameters as well as using json
.
@fverry I'm wondering why you chose this as the fix though. Would it not be better to fix RequestFactory::getRequestWithOptions to use GuzzleHttp\Client::applyOptions() instead of cherry-picking only headers
, body
, and version
?
Wow thank god I found this thread because I was having a hell of a time getting POST requests to work. $oauth2client->getHttpClient()->send($request, $options);
saved the day.
Sending url-encoded params, json or multipart requests with Guzzle is easy, because shortcuts are implemented within
GuzzleHttp\Client::applyOptions()
.Currently, those shortcuts are unreachable through the League OAuth2 Client, and thus all its providers.
This fix relies on
AbstractProvider::getResponse()
, and does not affectAbstractProvider::getAuthenticatedRequest()
.GuzzleHttp\ClientInterface::send()
method supports a second optional$options
parameter since v6.0.Upgrading
AbstractProvider::getResponse()
to support this second optional parameter allows the developper to use a"form_params"
,"json"
or"multipart"
option key :See also
Fixes: #935 #985 Duplicates: #967
For immediate use
Run the following on composer CLI:
Workaround
Use:
Instead of: