parent
0ff3fda3ac
commit
fbddc7c7eb
|
@ -138,7 +138,7 @@ abstract class OAuth2
|
|||
\curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||
\curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
\curl_setopt($ch, CURLOPT_USERAGENT, '');
|
||||
\curl_setopt($ch, CURLOPT_USERAGENT, 'Appwrite OAuth2');
|
||||
|
||||
if (!empty($payload)) {
|
||||
\curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||
|
|
|
@ -15,7 +15,7 @@ class Github extends OAuth2
|
|||
* @var array
|
||||
*/
|
||||
protected $scopes = [
|
||||
'user:email'
|
||||
'user',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -78,6 +78,7 @@ class Github extends OAuth2
|
|||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
var_dump($user);
|
||||
if (isset($user['id'])) {
|
||||
return $user['id'];
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ class Github extends OAuth2
|
|||
* @return array
|
||||
*/
|
||||
protected function getUser(string $accessToken)
|
||||
{
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$this->user = \json_decode($this->request('GET', 'https://api.github.com/user', ['Authorization: token '.\urlencode($accessToken)]), true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue