Implemented public scopes repository. Fix some auth cases [skip ci]

This commit is contained in:
ErickSkrauch
2019-09-13 01:19:03 +03:00
parent 4dc2a3025b
commit 8a1d7148d0
4 changed files with 64 additions and 2 deletions

View File

@ -107,6 +107,7 @@ class OauthProcess {
}
$authRequest->setUser(new UserEntity($account->id));
$authRequest->setAuthorizationApproved(true);
$responseObj = $this->server->completeAuthorizationRequest($authRequest, new Response(200));
$response = [
@ -250,10 +251,15 @@ class OauthProcess {
}
private function buildErrorResponse(OAuthServerException $e): array {
$hint = $e->getPayload()['hint'] ?? '';
if (preg_match('/the `(\w+)` scope/', $hint, $matches)) {
$parameter = $matches[1];
}
$response = [
'success' => false,
'error' => $e->getErrorType(),
// 'parameter' => $e->parameter, // TODO: if this is necessary, the parameter can be extracted from the hint
'parameter' => $parameter ?? null,
'statusCode' => $e->getHttpStatusCode(),
];