mirror of
https://github.com/appwrite/appwrite
synced 2026-05-12 03:28:35 +00:00
fix: auth user
This commit is contained in:
parent
55360c3af0
commit
0517ebfb4e
2 changed files with 3 additions and 24 deletions
|
|
@ -1346,16 +1346,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
|||
);
|
||||
}
|
||||
|
||||
$oauth2ID = '';
|
||||
try {
|
||||
$oauth2ID = $oauth2->getUserID($accessToken);
|
||||
} catch (Exception $ex) {
|
||||
$failureRedirect(
|
||||
$ex->getType(),
|
||||
'Failed to obtain user ID. The ' . $providerName . ' OAuth2 provider returned an error: ' . $ex->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
$oauth2ID = $oauth2->getUserID($accessToken);
|
||||
if (empty($oauth2ID)) {
|
||||
$failureRedirect(Exception::USER_MISSING_ID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ class Slack extends OAuth2
|
|||
* @var array
|
||||
*/
|
||||
protected array $scopes = [
|
||||
'openid',
|
||||
'email',
|
||||
'profile',
|
||||
'users:read',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -63,13 +61,7 @@ class Slack extends OAuth2
|
|||
'code' => $code,
|
||||
'redirect_uri' => $this->callback
|
||||
])
|
||||
), true);
|
||||
|
||||
if (!$this->tokens['ok']) {
|
||||
throw new \Exception('Error in fetching access token: ' . $this->tokens['error']);
|
||||
}
|
||||
|
||||
$this->tokens['access_token'] = $this->tokens['authed_user']['access_token'];
|
||||
), true)['authed_user'];
|
||||
}
|
||||
|
||||
return $this->tokens;
|
||||
|
|
@ -174,10 +166,6 @@ class Slack extends OAuth2
|
|||
);
|
||||
|
||||
$this->user = \json_decode($user, true);
|
||||
|
||||
if (!$this->user['ok']) {
|
||||
throw new \Exception('Error in fetching user: ' . $this->user['error']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
|
|
|
|||
Loading…
Reference in a new issue