From 0db4bdfcc43a32948f53c4599e0f7dc74f1d7fee Mon Sep 17 00:00:00 2001
From: hugang <18768366022@163.com>
Date: Sat, 26 Oct 2024 14:59:28 +0800
Subject: [PATCH] change login authorization url

---
 oauth2_provider/app/views/oauth2.py | 2 +-
 oauth2_web/.gitignore               | 4 +++-
 oauth2_web/src/views/Login.vue      | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/oauth2_provider/app/views/oauth2.py b/oauth2_provider/app/views/oauth2.py
index 8e7bb98..ec44a13 100644
--- a/oauth2_provider/app/views/oauth2.py
+++ b/oauth2_provider/app/views/oauth2.py
@@ -129,7 +129,7 @@ class OauthorizeView(BaseResponse, OAuth2):
             redirect_url = (
                 (request.args.get('redirect_to_url') or self.login_uri)
                 + "?authorization_uri="
-                + quote(auth_request.uri)
+                + quote(request.full_path)
             )
             if not self._validate_token(request.cookies.get('Authorization')):
                 raise InvalidTokenError("Invalid token")
diff --git a/oauth2_web/.gitignore b/oauth2_web/.gitignore
index e83bf3e..5493dd1 100644
--- a/oauth2_web/.gitignore
+++ b/oauth2_web/.gitignore
@@ -1,2 +1,4 @@
 pnpm-lock.yaml
-node_modules
\ No newline at end of file
+node_modules
+
+dist
diff --git a/oauth2_web/src/views/Login.vue b/oauth2_web/src/views/Login.vue
index 7e88371..42e7a51 100644
--- a/oauth2_web/src/views/Login.vue
+++ b/oauth2_web/src/views/Login.vue
@@ -80,7 +80,9 @@ async function login() {
   } else {
     const [_, res] = await api.login(form)
     if (res) {
-      window.location.href = authorizationUri as any
+      const url = new URL(window.location.href)
+      const authUrl = `${url.origin}${authorizationUri}`
+      window.location.href = authUrl
     }
   }
   isSubmiting.value = false
-- 
2.33.0

