aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/__init__.py')
-rw-r--r--python/fatcat_web/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py
index 0afee70e..34618076 100644
--- a/python/fatcat_web/__init__.py
+++ b/python/fatcat_web/__init__.py
@@ -26,14 +26,21 @@ conf = fatcat_client.Configuration()
conf.host = Config.FATCAT_API_HOST
api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf))
-from fatcat_web import routes, auth
+def auth_api(token):
+ conf = fatcat_client.Configuration()
+ conf.api_key["Authorization"] = token
+ conf.api_key_prefix["Authorization"] = "Bearer"
+ conf.host = Config.FATCAT_API_HOST
+ return fatcat_client.DefaultApi(fatcat_client.ApiClient(conf))
if Config.FATCAT_API_AUTH_TOKEN:
print("Found and using privileged token (eg, for account signup)")
- priv_api = auth.auth_api(Config.FATCAT_API_AUTH_TOKEN)
+ priv_api = auth_api(Config.FATCAT_API_AUTH_TOKEN)
else:
print("No privileged token found")
priv_api = None
+from fatcat_web import routes, auth
+
gitlab_bp = create_flask_blueprint(Gitlab, oauth, auth.handle_oauth)
app.register_blueprint(gitlab_bp, url_prefix='/auth/gitlab')