aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/__init__.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-12-05 16:47:46 +0300
committerFrederick Muriuki Muriithi2023-12-05 16:48:48 +0300
commitd59c3c49b2fcb60550be68f241f2526895512e94 (patch)
tree0de23e15b8b9a66ab78d4fd394603f9ef54112dd /gn_auth/__init__.py
parentd2ad3b1abffdeeb52e1b5f5a303a381aa3dd477c (diff)
downloadgn-auth-d59c3c49b2fcb60550be68f241f2526895512e94.tar.gz
Enable CORS to allow access from GN2 javascript
Diffstat (limited to 'gn_auth/__init__.py')
-rw-r--r--gn_auth/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/gn_auth/__init__.py b/gn_auth/__init__.py
index 8bd0093..79f52fd 100644
--- a/gn_auth/__init__.py
+++ b/gn_auth/__init__.py
@@ -5,6 +5,7 @@ import logging
from typing import Optional
from flask import Flask
+from flask_cors import CORS
from gn_auth.misc_views import misc
from gn_auth.auth.views import oauth2
@@ -76,6 +77,12 @@ def create_app(config: Optional[dict] = None) -> Flask:
setup_logging_handlers(app)
setup_oauth2_server(app)
+ CORS(
+ app,
+ origins=app.config["CORS_ORIGINS"],
+ allow_headers=app.config["CORS_HEADERS"],
+ supports_credentials=True, intercept_exceptions=False)
+
## Blueprints
app.register_blueprint(misc, url_prefix="/")
app.register_blueprint(oauth2, url_prefix="/auth")