Skip to content

Commit 8f794c0

Browse files
authored
feat: oauth provider (#549)
* fix: files for oauth2 providers * fix: interface * fix: oauth2 interfaces * fix: update recipe.py * fix: login request impl * fix: query params for put request * fix: consent request * fix: more impl * fix: more impl * fix: recipe impl * fix: recipe impl * fix: validate_oauth2_access_token * fix: authorization * fix: token exchange * fix: frontend redirection url * fix: revoke token * fix: end session * fix: api stubs * fix: api structures and lint fixes * fix: remaining type fixes * fix: end session * fix: api endpoints * fix: remaining apis * fix: remaining impl * fix: typing * fix: type and lint * fix: types, exposed functions and cyclic import * fix: backend sdk tests * fix: default recipes and fixes for test * fix: tests * fix: tests * fix: tests * fix: tests * fix: tests * fix: tests * fix: openid and cookies * fix: roles and permissions for oauth2 * fix: auth react tests * fix: tests and changes for oauth2 provider (#551) * fix: cdi and fdi versions * fix: deps * fix: sdk version * fix: tests * fix: website reset * fix: website tests * fix: test scripts for oauth2 * fix: website tests * fix: unit test * fix: unit test * fix: django headers * fix: better types * fix: review comments * fix: test server * fix: changelog * fix: check lint output in pre-commit * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import * fix: cyclic import
1 parent ee275a5 commit 8f794c0

File tree

83 files changed

+6034
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6034
-68
lines changed

.circleci/config_continue.yml

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
test-backend-sdk-testing:
3535
docker:
3636
- image: python:<< parameters.python-version >>
37+
- image: rishabhpoddar/oauth-server-cicd
3738
resource_class: large
3839
parameters:
3940
cdi-version:
@@ -54,6 +55,7 @@ jobs:
5455
test-website-fastapi:
5556
docker:
5657
- image: python:<< parameters.python-version >>
58+
- image: rishabhpoddar/oauth-server-cicd
5759
resource_class: large
5860
parameters:
5961
fdi-version:
@@ -74,6 +76,7 @@ jobs:
7476
test-website-flask:
7577
docker:
7678
- image: python:<< parameters.python-version >>
79+
- image: rishabhpoddar/oauth-server-cicd
7780
resource_class: large
7881
parameters:
7982
fdi-version:
@@ -94,6 +97,7 @@ jobs:
9497
test-website-django:
9598
docker:
9699
- image: python:<< parameters.python-version >>
100+
- image: rishabhpoddar/oauth-server-cicd
97101
resource_class: large
98102
parameters:
99103
fdi-version:
@@ -114,6 +118,7 @@ jobs:
114118
test-website-drf-async:
115119
docker:
116120
- image: python:<< parameters.python-version >>
121+
- image: rishabhpoddar/oauth-server-cicd
117122
resource_class: large
118123
parameters:
119124
fdi-version:
@@ -134,6 +139,7 @@ jobs:
134139
test-website-drf-sync:
135140
docker:
136141
- image: python:<< parameters.python-version >>
142+
- image: rishabhpoddar/oauth-server-cicd
137143
resource_class: large
138144
parameters:
139145
fdi-version:
@@ -154,6 +160,7 @@ jobs:
154160
test-website-django2x:
155161
docker:
156162
- image: python:<< parameters.python-version >>
163+
- image: rishabhpoddar/oauth-server-cicd
157164
resource_class: large
158165
parameters:
159166
fdi-version:
@@ -174,6 +181,7 @@ jobs:
174181
test-website-flask-nest-asyncio:
175182
docker:
176183
- image: python:<< parameters.python-version >>
184+
- image: rishabhpoddar/oauth-server-cicd
177185
resource_class: large
178186
environment:
179187
SUPERTOKENS_NEST_ASYNCIO: "1"
@@ -197,6 +205,7 @@ jobs:
197205
test-authreact-fastapi:
198206
docker:
199207
- image: python:<< parameters.python-version >>
208+
- image: rishabhpoddar/oauth-server-cicd
200209
environment:
201210
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml
202211
parameters:
@@ -227,6 +236,7 @@ jobs:
227236
test-authreact-flask:
228237
docker:
229238
- image: python:<< parameters.python-version >>
239+
- image: rishabhpoddar/oauth-server-cicd
230240
resource_class: large
231241
environment:
232242
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml
@@ -258,6 +268,7 @@ jobs:
258268
test-authreact-django:
259269
docker:
260270
- image: python:<< parameters.python-version >>
271+
- image: rishabhpoddar/oauth-server-cicd
261272
resource_class: large
262273
environment:
263274
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml

.circleci/markDevTagAsTestNotPassed.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ while IFS='"' read -ra ADDR; do
2121
done
2222
done <<< "$version"
2323

24-
responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \
24+
responseStatus=`curl -s -o out.bin -w "%{http_code}" -X PUT \
2525
https://api.supertokens.io/0/driver \
2626
-H 'Content-Type: application/json' \
2727
-H 'api-version: 0' \
@@ -35,5 +35,6 @@ responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \
3535
if [ $responseStatus -ne "200" ]
3636
then
3737
echo "failed core PUT API status code: $responseStatus. Exiting!"
38+
cat out.bin
3839
exit 1
3940
fi

.circleci/setupAndTestBackendSDKWithFreeCore.sh

+7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4343
./loadModules --ssh
4444
cd supertokens-core
4545
git checkout $coreTag
46+
47+
# Update oauth provider config in devConfig.yaml
48+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
49+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
50+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
51+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
52+
4653
cd ../supertokens-plugin-interface
4754
git checkout $pluginInterfaceTag
4855
cd ../

.circleci/setupAndTestWithAuthReact.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithAuthReactWithDjango.sh

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4141
./loadModules --ssh
4242
cd supertokens-core
4343
git checkout $coreTag
44+
45+
# Update oauth provider config in devConfig.yaml
46+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
47+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
48+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
49+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
50+
4451
cd ../supertokens-plugin-interface
4552
git checkout $pluginInterfaceTag
4653
cd ../

.circleci/setupAndTestWithAuthReactWithFlask.sh

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4141
./loadModules --ssh
4242
cd supertokens-core
4343
git checkout $coreTag
44+
45+
# Update oauth provider config in devConfig.yaml
46+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
47+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
48+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
49+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
50+
4451
cd ../supertokens-plugin-interface
4552
git checkout $pluginInterfaceTag
4653
cd ../

.circleci/setupAndTestWithFreeCore.sh

+7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4343
./loadModules --ssh
4444
cd supertokens-core
4545
git checkout $coreTag
46+
47+
# Update oauth provider config in devConfig.yaml
48+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
49+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
50+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
51+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
52+
4653
cd ../supertokens-plugin-interface
4754
git checkout $pluginInterfaceTag
4855
cd ../

.circleci/setupAndTestWithFrontend.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDjango.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDjango2x.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDrfAsync.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDrfSync.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithFlask.sh

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ disable=raw-checker-failed,
124124
no-else-raise,
125125
too-many-nested-blocks,
126126
broad-exception-raised,
127+
too-many-public-methods,
127128

128129

129130
# Enable the message, report, category or checker with the given id(s). You can

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11+
## [0.27.0] - 2024-12-30
12+
13+
- Added OAuth2Provider recipe
14+
- Added support for FDIs: 4.0. Required by: auth-react >=0.48.0 and web-js>=0.14.0
15+
1116
## [0.26.1] - 2024-11-28
1217

1318
- Fixes dependency for docs build

coreDriverInterfaceSupported.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
33
"versions": [
4-
"5.1"
4+
"5.2"
55
]
66
}

dev-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ flask-cors==5.0.0
99
nest-asyncio==1.6.0
1010
pdoc3==0.11.0
1111
pylint==3.2.7
12-
pyright==1.1.389
12+
pyright==1.1.391
1313
python-dotenv==1.0.1
1414
pytest==8.3.3
1515
pytest-asyncio==0.24.0

examples/with-flask/with-thirdpartyemailpassword/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
dashboard,
1616
emailverification,
1717
session,
18+
usermetadata,
1819
thirdparty,
1920
)
21+
from supertokens_python.recipe.session import SessionContainer
2022
from supertokens_python.recipe.session.framework.flask import verify_session
2123

2224
load_dotenv()
@@ -46,6 +48,7 @@ def get_website_domain():
4648
session.init(),
4749
dashboard.init(),
4850
emailverification.init("REQUIRED"),
51+
usermetadata.init(),
4952
thirdparty.init(
5053
sign_in_and_up_feature=thirdparty.SignInAndUpFeature(
5154
providers=[
@@ -156,7 +159,7 @@ def get_website_domain():
156159
@app.route("/sessioninfo", methods=["GET"]) # type: ignore
157160
@verify_session()
158161
def get_session_info():
159-
session_: session.SessionContainer = g.supertokens
162+
session_: SessionContainer = g.supertokens
160163
return jsonify(
161164
{
162165
"sessionHandle": session_.get_handle(),

frontendDriverInterfaceSupported.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"1.19",
77
"2.0",
88
"3.0",
9-
"3.1"
9+
"3.1",
10+
"4.0"
1011
]
1112
}

hooks/pre-commit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ then
2121
git stash push -k -u -- ${files_to_stash} >/dev/null 2>/dev/null
2222
fi
2323

24-
make check-lint >/dev/null 2>/dev/null
24+
make check-lint
2525
linted=$?
2626

2727
echo "$(tput setaf 3)* Properly linted?$(tput sgr 0)"

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
setup(
8585
name="supertokens_python",
86-
version="0.26.1",
86+
version="0.27.0",
8787
author="SuperTokens",
8888
license="Apache 2.0",
8989
author_email="[email protected]",
@@ -127,6 +127,7 @@
127127
"aiosmtplib>=1.1.6,<4.0.0",
128128
"pkce<1.1.0",
129129
"pyotp<3",
130+
"python-dateutil<3",
130131
],
131132
python_requires=">=3.8",
132133
include_package_data=True,

supertokens_python/auth_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ async def check_auth_type_and_linking_status(
536536
if session_user_result.status == "SHOULD_AUTOMATICALLY_LINK_FALSE":
537537
if should_try_linking_with_session_user is True:
538538
raise BadInputError(
539-
"should_do_automatic_account_linking returned false when creating primary user but shouldTryLinkingWithSessionUser is true"
539+
"shouldDoAutomaticAccountLinking returned false when making the session user primary but shouldTryLinkingWithSessionUser is true"
540540
)
541541
return OkFirstFactorResponse()
542542
elif (
@@ -565,7 +565,7 @@ async def check_auth_type_and_linking_status(
565565
if isinstance(should_link, ShouldNotAutomaticallyLink):
566566
if should_try_linking_with_session_user is True:
567567
raise BadInputError(
568-
"should_do_automatic_account_linking returned false when creating primary user but shouldTryLinkingWithSessionUser is true"
568+
"shouldDoAutomaticAccountLinking returned false when making the session user primary but shouldTryLinkingWithSessionUser is true"
569569
)
570570
return OkFirstFactorResponse()
571571
else:

supertokens_python/constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
from __future__ import annotations
1616

17-
SUPPORTED_CDI_VERSIONS = ["5.1"]
18-
VERSION = "0.26.1"
17+
SUPPORTED_CDI_VERSIONS = ["5.2"]
18+
VERSION = "0.27.0"
1919
TELEMETRY = "/telemetry"
2020
USER_COUNT = "/users/count"
2121
USER_DELETE = "/user/remove"

supertokens_python/framework/django/django_request.py

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def get_cookie(self, key: str) -> Union[str, None]:
5757

5858
def get_header(self, key: str) -> Union[None, str]:
5959
key = key.replace("-", "_")
60+
if key.upper() in self.request.META:
61+
return self.request.META.get(key.upper())
6062
key = "HTTP_" + key
6163
return self.request.META.get(key.upper())
6264

0 commit comments

Comments
 (0)