From c70c2ae8a165e7e68a8dd4769fc4d59f21791208 Mon Sep 17 00:00:00 2001 From: FoskyM Date: Sun, 1 Oct 2023 22:36:27 +0800 Subject: [PATCH] fix: authorize --- js/dist/forum.js | Bin 7383 -> 7482 bytes js/dist/forum.js.map | Bin 24182 -> 24576 bytes .../forum/components/oauth/AuthorizePage.js | 9 ++++++++- src/Controllers/AuthorizeController.php | 6 ++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index 319120c1608426433c586c27ebbaf42bd46a8aed..d5bc252c77ffaa5bbf767791667ca5a15e31dcfd 100644 GIT binary patch delta 157 zcmWm3F$%&k6o6sG(F@ecl0gzuvTF$T1cGxZ5^8Fn=zHZgwNr8PJVG}w;&r6s|NXz+ zcmK(g)zfntTx_7TQ=V)VuNlY{rLBqO9Gn8CQITo;u92*T6FL@LDm!0v!L*+Jqca>X zz@dugo{B(^H&CS;(lbHb{X%0yM diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index faae6328c5aa2d45368305ed0101e862c7199214..47f846962e9f66fdfb0f8e9b8ac1caae38b8c183 100644 GIT binary patch delta 862 zcmX|;&rcIU6vtCy41tp|^j88*umKt;g(3uqDfo6eUCUZ3wuK-zwo#zlmff;#A=)(P z)ti}RcUSuy;h1z`$_C&8-}kpgB7o!j`XkT>M<~gbW(G`z`s=C?o*iur z4-4uw9=d4_vZ6kPZ&_{0cSyMhLL#M*t2%xlVr$9ZC4drd7+~TZ(N7G?h;sK>Xvi$L zgtdbBYBI7mfmtGFj-TM;Z3~j`H8ZLnnHq7WdJ{1NXX;1f-t4k=%Xt_Uh%HP{0KO~X z18NWj!;u}e7M-4WAqlsHQPX=D^?I(F(eOx8svE(ZgLhGH^`cevsweF@OKq^;6Nl+v z^RUCJp2t$`pzPO}cKrI&PR(vFtB>XQ3|h_bnFjvJ5I;i?-1si)XZihqAUgN1 delta 466 zcmX9)%}T>S5GGzMdhw68Nl`08P`X%K)S83V$z&Tf#HzLQSgMHD{zM~+Er`B?%vJCO zJQOOPJopNI55b!^!QJ(;J3F)A-#mV5KOb7}btKaALz@+$-G3YT9Ua4cU>txWtJ{Eu zOBzI{wGMqpW12<7v7?!*0`mciIbs}e)b5CFuH@x@fsrE7YOFAZ4*>ctatSyv(immmbm0cl5d*8i_AeZ|el z+W#X%hHge04l4jGCk|@A zjM;R+rMGfMDSAh0g)J^2T}Lg{XE!$RLj?&rjYlW@*+iI|3Kx?bo5_=)eH}DUmzu%Z TLb%v}C_RmmUNyClYSouNur`DA diff --git a/js/src/forum/components/oauth/AuthorizePage.js b/js/src/forum/components/oauth/AuthorizePage.js index 02a757d..bc87b36 100644 --- a/js/src/forum/components/oauth/AuthorizePage.js +++ b/js/src/forum/components/oauth/AuthorizePage.js @@ -206,7 +206,14 @@ export default class AuthorizePage extends IndexPage { scope: this.params.scope, 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 } diff --git a/src/Controllers/AuthorizeController.php b/src/Controllers/AuthorizeController.php index 325b614..96902af 100644 --- a/src/Controllers/AuthorizeController.php +++ b/src/Controllers/AuthorizeController.php @@ -49,8 +49,10 @@ class AuthorizeController implements RequestHandlerInterface $server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id); 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 - /* $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); - exit("SUCCESS! Authorization Code: $code");*/ + $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40); + return new JsonResponse([ + 'code' => $code + ]); } $response->getResponseBody(); return new JsonResponse(json_decode($response->getResponseBody(), true));