diff options
author | zsloan | 2023-06-30 18:48:09 +0000 |
---|---|---|
committer | zsloan | 2023-06-30 18:48:09 +0000 |
commit | e12e6d376de997e19032e06a60599f8752078dd5 (patch) | |
tree | b66084764dac778b905d9250ff052c6c130106f2 /wqflask | |
parent | 8bfb79da9b8dc0591532939dca97e0fa9c06c5d2 (diff) | |
download | genenetwork2-e12e6d376de997e19032e06a60599f8752078dd5.tar.gz |
Fixed URL scheme issues
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/oauth2/request_utils.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/oauth2/toplevel.py | 5 |
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"] } |