Skip to content

Commit

Permalink
Fix GitHub getUserInfo need Authorization header (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Nov 2, 2021
1 parent 7f92096 commit 096a740
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Github/OAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ protected function __getAccessToken($storeState, $code = null, $state = null)
*/
public function getUserInfo($accessToken = null)
{
$this->result = $this->http->ua('YurunOAuthLogin')->get($this->getUrl('user', [
'access_token' => null === $accessToken ? $this->accessToken : $accessToken,
]))->json(true);
$token = null === $accessToken ? $this->accessToken : $accessToken;
$this->result = $this->http->ua('YurunOAuthLogin')
->header('Authorization', "token {$token}")
->get($this->getUrl('user'))
->json(true);
if (isset($this->result['message']))
{
throw new ApiException($this->result['message'], 0);
Expand Down

0 comments on commit 096a740

Please sign in to comment.