aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/oauth2/request_utils.py2
-rw-r--r--wqflask/wqflask/oauth2/toplevel.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/wqflask/wqflask/oauth2/request_utils.py b/wqflask/wqflask/oauth2/request_utils.py
index 992720f1..9c58cada 100644
--- a/wqflask/wqflask/oauth2/request_utils.py
+++ b/wqflask/wqflask/oauth2/request_utils.py
@@ -11,7 +11,7 @@ from .client import SCOPE, oauth2_get
def authserver_authorise_uri():
from utility.tools import GN_SERVER_URL, OAUTH2_CLIENT_ID
- req_baseurl = urlparse(request.base_url)
+ req_baseurl = urlparse(request.base_url, scheme=request.scheme)
host_uri = f"{req_baseurl.scheme}://{req_baseurl.netloc}/"
return urljoin(
GN_SERVER_URL,
diff --git a/wqflask/wqflask/oauth2/toplevel.py b/wqflask/wqflask/oauth2/toplevel.py
index 61d53dfe..eeeb2da3 100644
--- a/wqflask/wqflask/oauth2/toplevel.py
+++ b/wqflask/wqflask/oauth2/toplevel.py
@@ -1,6 +1,6 @@
"""Authentication endpoints."""
from uuid import UUID
-from urllib.parse import urljoin
+from urllib.parse import urljoin, urlparse, urlunparse
from flask import (
flash, request, Blueprint, url_for, redirect, render_template,
current_app as app)
@@ -40,12 +40,13 @@ def authorisation_code():
code = request.args.get("code", "")
if bool(code):
+ base_url = urlparse(request.base_url, scheme=request.scheme)
request_data = {
"grant_type": "authorization_code",
"code": code,
"scope": SCOPE,
"redirect_uri": urljoin(
- request.base_url,
+ urlunparse(base_url),
url_for("oauth2.toplevel.authorisation_code")),
"client_id": app.config["OAUTH2_CLIENT_ID"]
}