debugging

This commit is contained in:
Chirag Aggarwal 2025-01-17 07:43:50 +00:00
parent 983eee9266
commit 55360c3af0
2 changed files with 14 additions and 3 deletions

View file

@ -1346,7 +1346,16 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
);
}
$oauth2ID = $oauth2->getUserID($accessToken);
$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(),
);
}
if (empty($oauth2ID)) {
$failureRedirect(Exception::USER_MISSING_ID);
}

View file

@ -66,8 +66,10 @@ class Slack extends OAuth2
), true);
if (!$this->tokens['ok']) {
throw new \Exception('Error in fetching access token.');
throw new \Exception('Error in fetching access token: ' . $this->tokens['error']);
}
$this->tokens['access_token'] = $this->tokens['authed_user']['access_token'];
}
return $this->tokens;
@ -174,7 +176,7 @@ class Slack extends OAuth2
$this->user = \json_decode($user, true);
if (!$this->user['ok']) {
throw new \Exception('Error in fetching user.');
throw new \Exception('Error in fetching user: ' . $this->user['error']);
}
}