aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/oauth2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-18 20:35:26 +0300
committerFrederick Muriuki Muriithi2024-04-23 11:49:08 +0300
commita1b4e9a245158a9735f5f49b5f12d6df3f8d53c5 (patch)
tree089452a4fb17b31fb3b1ba372d5ff466d2cf37f3 /gn2/wqflask/oauth2
parent3838adf514ce0a5a1dc056521e0282d95ea619c9 (diff)
downloadgenenetwork2-a1b4e9a245158a9735f5f49b5f12d6df3f8d53c5.tar.gz
Use the JWT Bearer grant type
Diffstat (limited to 'gn2/wqflask/oauth2')
-rw-r--r--gn2/wqflask/oauth2/toplevel.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/gn2/wqflask/oauth2/toplevel.py b/gn2/wqflask/oauth2/toplevel.py
index dffc0a7c..a120fe9b 100644
--- a/gn2/wqflask/oauth2/toplevel.py
+++ b/gn2/wqflask/oauth2/toplevel.py
@@ -18,6 +18,7 @@ def register_client():
"""Register an OAuth2 client."""
return "USER IS LOGGED IN AND SUCCESSFULLY ACCESSED THIS ENDPOINT!"
+
@toplevel.route("/code", methods=["GET"])
def authorisation_code():
"""Use authorisation code to get token."""
@@ -42,12 +43,13 @@ def authorisation_code():
if bool(code):
base_url = urlparse(request.base_url, scheme=request.scheme)
request_data = {
- "grant_type": "authorization_code",
+ "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
"code": code,
"scope": SCOPE,
"redirect_uri": urljoin(
urlunparse(base_url),
url_for("oauth2.toplevel.authorisation_code")),
+ "assertion": request.args["jwt"],
"client_id": app.config["OAUTH2_CLIENT_ID"]
}
return no_token_post(