Skip to content
Snippets Groups Projects
Commit 9836a576 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

dont do async with flask

parent 400f0690
Branches
Tags
No related merge requests found
Pipeline #131349 passed
import os, random, string, logging import os, random, string, logging
from authlib.integrations.flask_client import OAuth from authlib.integrations.flask_client import OAuth
from flask import url_for, redirect, current_app as app, Blueprint from flask import url_for, redirect, current_app as app, Blueprint, abort
from flask_login import login_user from flask_login import login_user
from flask_appbuilder import BaseView as AppBuilderBaseView from flask_appbuilder import BaseView as AppBuilderBaseView
from airflow.plugins_manager import AirflowPlugin from airflow.plugins_manager import AirflowPlugin
...@@ -35,9 +35,12 @@ class UnityIntegrationView(AppBuilderBaseView): ...@@ -35,9 +35,12 @@ class UnityIntegrationView(AppBuilderBaseView):
return oauth.unity.authorize_redirect(redirect_uri) return oauth.unity.authorize_redirect(redirect_uri)
@unity.route('/authorize') @unity.route('/authorize')
async def authorize(): def authorize():
token = await oauth.unity.authorize_access_token() try:
user = await oauth.unity.userinfo(token=token) token = oauth.unity.authorize_access_token()
except:
abort(403)
user = oauth.unity.userinfo(token=token)
# get relevant data from token # get relevant data from token
email = user['email'] email = user['email']
persistent_identifier = user["sub"] persistent_identifier = user["sub"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment