@@ -273,13 +273,7 @@ public function setClientSecret($clientSecret)
273
273
public function getAccessToken ($ code = '' )
274
274
{
275
275
if (!empty ($ code )) {
276
- $ uri = $ this ->buildUrl ('accessToken ' , [
277
- 'grant_type ' => self ::OAUTH2_GRANT_TYPE ,
278
- self ::OAUTH2_RESPONSE_TYPE => $ code ,
279
- 'redirect_uri ' => $ this ->getRedirectUrl (),
280
- 'client_id ' => $ this ->getClientId (),
281
- 'client_secret ' => $ this ->getClientSecret (),
282
- ]);
276
+ $ uri = $ this ->buildUrl ('accessToken ' , []);
283
277
$ guzzle = new GuzzleClient ([
284
278
'base_uri ' => $ this ->getOAuthApiRoot (),
285
279
'headers ' => [
@@ -288,7 +282,13 @@ public function getAccessToken($code = '')
288
282
],
289
283
]);
290
284
try {
291
- $ response = $ guzzle ->get ($ uri );
285
+ $ response = $ guzzle ->post ($ uri , ['form_params ' => [
286
+ 'grant_type ' => self ::OAUTH2_GRANT_TYPE ,
287
+ self ::OAUTH2_RESPONSE_TYPE => $ code ,
288
+ 'redirect_uri ' => $ this ->getRedirectUrl (),
289
+ 'client_id ' => $ this ->getClientId (),
290
+ 'client_secret ' => $ this ->getClientSecret (),
291
+ ]]);
292
292
} catch (RequestException $ exception ) {
293
293
throw Exception::fromRequestException ($ exception );
294
294
}
0 commit comments