fix: authorize

This commit is contained in:
FoskyM 2023-10-01 22:36:27 +08:00
parent b7d78c0af4
commit c70c2ae8a1
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
4 changed files with 12 additions and 3 deletions

BIN
js/dist/forum.js generated vendored

Binary file not shown.

BIN
js/dist/forum.js.map generated vendored

Binary file not shown.

View file

@ -206,7 +206,14 @@ export default class AuthorizePage extends IndexPage {
scope: this.params.scope, scope: this.params.scope,
is_authorized: this.is_authorized, is_authorized: this.is_authorized,
} }
}).then((r) => console.log(r)); }).then((params) => {
let arr = []
for (let k in params) {
arr.push(`${k}=${params[k]}`)
}
let url = `${this.params.redirect_uri }?${arr.join('&')}`;
window.location.href = url;
});
// Some form handling logic here // Some form handling logic here
} }

View file

@ -49,8 +49,10 @@ class AuthorizeController implements RequestHandlerInterface
$server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id); $server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id);
if ($is_authorized) { if ($is_authorized) {
// this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client // this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
/* $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
exit("SUCCESS! Authorization Code: $code");*/ return new JsonResponse([
'code' => $code
]);
} }
$response->getResponseBody(); $response->getResponseBody();
return new JsonResponse(json_decode($response->getResponseBody(), true)); return new JsonResponse(json_decode($response->getResponseBody(), true));