1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00

Merge pull request #457 from appwrite/eldadfux/issue456

Unable to use GitHub OAuth provider
This commit is contained in:
Eldad A. Fux 2020-06-28 18:33:45 +03:00 committed by GitHub
commit 17b9dc76a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 12 deletions

View file

@ -36,6 +36,7 @@
- Fixed bug preventing the deletion of the project logo
- Fixed Bug when trying to overwrite OAuth cookie in the Flutter SDK
- Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454))
- Fixed bug denying authentication with Github OAuth provider
## Security

15
composer.lock generated
View file

@ -2141,24 +2141,23 @@
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "790426f28bfcbfc1a6f1d59ee8c986edfa45395c"
"reference": "664187301bfbc87e686df212094e6817805c3ab8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/790426f28bfcbfc1a6f1d59ee8c986edfa45395c",
"reference": "790426f28bfcbfc1a6f1d59ee8c986edfa45395c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/664187301bfbc87e686df212094e6817805c3ab8",
"reference": "664187301bfbc87e686df212094e6817805c3ab8",
"shasum": ""
},
"require": {
"ext-filter": "^7.1",
"php": "^7.2",
"ext-filter": "*",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpdocumentor/type-resolver": "^1.0",
"webmozart/assert": "^1"
},
"require-dev": {
"doctrine/instantiator": "^1",
"mockery/mockery": "^1"
"mockery/mockery": "1.3.*"
},
"type": "library",
"extra": {
@ -2186,7 +2185,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2020-06-19T18:58:43+00:00"
"time": "2020-06-27T17:33:53+00:00"
},
{
"name": "phpdocumentor/type-resolver",

View file

@ -50,7 +50,7 @@ services:
- ./phpunit.xml:/usr/share/nginx/html/phpunit.xml
- ./tests:/usr/share/nginx/html/tests
- ./app:/usr/share/nginx/html/app
# - ./vendor:/usr/share/nginx/html/vendor
# - ./vendor:/usr/share/nginx/html/vendor
- ./docs:/usr/share/nginx/html/docs
- ./public:/usr/share/nginx/html/public
- ./src:/usr/share/nginx/html/src

View file

@ -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);

View file

@ -15,7 +15,7 @@ class Github extends OAuth2
* @var array
*/
protected $scopes = [
'user:email'
'user:email',
];
/**
@ -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);
}