fix: oauth

This commit is contained in:
FoskyM 2023-10-01 22:10:21 +08:00
parent f76763496a
commit 19a17bc851
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
2 changed files with 6 additions and 5 deletions

View file

@ -35,14 +35,14 @@ class AuthorizeController implements RequestHandlerInterface
$params = $request->getParsedBody();
$oauth = new OAuth();
$oauth = new OAuth($this->settings);
$server = $oauth->server();
$request = $oauth->request()::createFromGlobals();
$response = $oauth->response();
if (!$server->validateAuthorizeRequest($request, $response)) {
$response->send();
die;
$response->getResponseBody();
return new JsonResponse(json_decode($response->getResponseBody(), true));
}
$is_authorized = (Arr::get($params, 'authorized', 'no') === 'yes');
@ -52,6 +52,7 @@ class AuthorizeController implements RequestHandlerInterface
/* $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
exit("SUCCESS! Authorization Code: $code");*/
}
$response->send();
$response->getResponseBody();
return new JsonResponse(json_decode($response->getResponseBody(), true));
}
}

View file

@ -433,7 +433,7 @@ class Storage implements
if ($result = Models\Scope::where('is_default', true)->get()) {
$defaultScope = array_map(function ($row) {
return $row['scope'];
}, $result);
}, $result->toArray());
return implode(' ', $defaultScope);
}