aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/oauth2
diff options
context:
space:
mode:
authorJohn Nduli2024-08-06 08:36:28 +0300
committerAlexander_Kabui2024-08-28 15:02:46 +0300
commit4aa2d88b2915323398c5b14a64e10f822df9a93e (patch)
tree0d7cb188fa83428e43525910b2e46bf16155d97b /gn2/wqflask/oauth2
parent6d39ea99231aa0d07726a013c9a17c89a72e407a (diff)
downloadgenenetwork2-4aa2d88b2915323398c5b14a64e10f822df9a93e.tar.gz
fix: use bearer token to query auth server
Diffstat (limited to 'gn2/wqflask/oauth2')
-rw-r--r--gn2/wqflask/oauth2/ui.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gn2/wqflask/oauth2/ui.py b/gn2/wqflask/oauth2/ui.py
index d70a13ec..89739fe3 100644
--- a/gn2/wqflask/oauth2/ui.py
+++ b/gn2/wqflask/oauth2/ui.py
@@ -1,6 +1,8 @@
"""UI utilities"""
from flask import session, render_template
+from gn2.wqflask.oauth2 import session
+
from .client import oauth2_get
from .client import user_logged_in
from .request_utils import process_error
@@ -13,7 +15,8 @@ def render_ui(templatepath: str, **kwargs):
lambda _err: roles, lambda auth_roles: auth_roles)
user_privileges = tuple(
privilege["privilege_id"] for role in roles for privilege in role["privileges"])
+ user_token = session.user_token().either(lambda _err: "", lambda token: token["access_token"])
kwargs = {
- **kwargs, "roles": roles, "user_privileges": user_privileges
+ **kwargs, "roles": roles, "user_privileges": user_privileges, "bearer_token": user_token
}
return render_template(templatepath, **kwargs)