aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/auth/authorize.py
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-02-21 01:44:01 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-02-21 01:44:01 +0300
commitf90d0c7fddb81215b907808b8365f63f42344652 (patch)
tree24cdb764870e97008c821cc84f7ab8a67d394b51 /backend/routes/auth/authorize.py
parentCentralizes Admin Authentication (diff)
Dynamically Selects OAuth Redirect URI
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend/routes/auth/authorize.py')
-rw-r--r--backend/routes/auth/authorize.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/backend/routes/auth/authorize.py b/backend/routes/auth/authorize.py
index c6cd86c..65709ab 100644
--- a/backend/routes/auth/authorize.py
+++ b/backend/routes/auth/authorize.py
@@ -87,7 +87,8 @@ class AuthorizeRoute(Route):
"""Generate an authorization token."""
data = await request.json()
try:
- bearer_token = await fetch_bearer_token(data["token"], refresh=False)
+ url = request.headers.get("origin")
+ bearer_token = await fetch_bearer_token(data["token"], url, refresh=False)
except httpx.HTTPStatusError:
return AUTH_FAILURE
@@ -111,7 +112,8 @@ class TokenRefreshRoute(Route):
"""Refresh an authorization token."""
try:
token = request.user.decoded_token.get("refresh")
- bearer_token = await fetch_bearer_token(token, refresh=True)
+ url = request.headers.get("origin")
+ bearer_token = await fetch_bearer_token(token, url, refresh=True)
except httpx.HTTPStatusError:
return AUTH_FAILURE