Skip to content

Commit 71d2605

Browse files
committed
chore: test to demonstrate bug
#1252
1 parent 7e628c4 commit 71d2605

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_authorization_code.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,27 @@ def test_request_body_params(self):
13081308
self.assertEqual(content["scope"], "read write")
13091309
self.assertEqual(content["expires_in"], self.oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS)
13101310

1311+
def test_request_body_params_client_typo(self):
1312+
"""
1313+
Request an access token using client_type: public
1314+
"""
1315+
self.client.login(username="test_user", password="123456")
1316+
authorization_code = self.get_auth()
1317+
1318+
token_request_data = {
1319+
"grant_type": "authorization_code",
1320+
"code": authorization_code,
1321+
"redirect_uri": "http://example.org",
1322+
"client": self.application.client_id,
1323+
"client_secret": CLEARTEXT_SECRET,
1324+
}
1325+
1326+
response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data)
1327+
self.assertEqual(response.status_code, 401)
1328+
1329+
content = json.loads(response.content.decode("utf-8"))
1330+
self.assertEqual(content["error"], "invalid_client")
1331+
13111332
def test_public(self):
13121333
"""
13131334
Request an access token using client_type: public

0 commit comments

Comments
 (0)