From 940a989fb4f3f6f9e2d2f980ebeb6e3df243dfc8 Mon Sep 17 00:00:00 2001 From: FoskyM Date: Mon, 2 Oct 2023 03:38:45 +0800 Subject: [PATCH] feat: oauth token(TokenController.php) --- src/Controllers/TokenController.php | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Controllers/TokenController.php diff --git a/src/Controllers/TokenController.php b/src/Controllers/TokenController.php new file mode 100644 index 0000000..63be7ed --- /dev/null +++ b/src/Controllers/TokenController.php @@ -0,0 +1,40 @@ +settings = $settings; + } + + public function handle(ServerRequestInterface $request): ResponseInterface + { + $oauth = new OAuth($this->settings); + $server = $oauth->server(); + + $body = $server->handleTokenRequest($oauth->request()::createFromGlobals()) + ->getResponseBody(); + return new JsonResponse(json_decode($body, true)); + } +}