Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add Authorization-Bearer to allowed CORS headers (#7565)

Cezary Miącz4dc79653319f
diff --git a/saleor/graphql/core/tests/test_view.py b/saleor/graphql/core/tests/test_view.py
index 35f6731a9e..285521ad44 100644
--- a/saleor/graphql/core/tests/test_view.py
+++ b/saleor/graphql/core/tests/test_view.py
@@ -111,7 +111,7 @@ def test_graphql_view_access_control_header(client, settings):
assert response[ACCESS_CONTROL_ALLOW_METHODS] == "POST, OPTIONS"
assert (
response[ACCESS_CONTROL_ALLOW_HEADERS]
- == "Origin, Content-Type, Accept, Authorization"
+ == "Origin, Content-Type, Accept, Authorization, Authorization-Bearer"
)
response = client.options(API_PATH)
diff --git a/saleor/graphql/views.py b/saleor/graphql/views.py
index 6c901dfdd2..1b856f2536 100644
--- a/saleor/graphql/views.py
+++ b/saleor/graphql/views.py
@@ -104,9 +104,10 @@ class GraphQLView(View):
"HTTP_ORIGIN"
]
response["Access-Control-Allow-Methods"] = "POST, OPTIONS"
- response[
- "Access-Control-Allow-Headers"
- ] = "Origin, Content-Type, Accept, Authorization"
+ response["Access-Control-Allow-Headers"] = (
+ "Origin, Content-Type, Accept, Authorization, "
+ "Authorization-Bearer"
+ )
response["Access-Control-Allow-Credentials"] = "true"
break
return response