From efb31d6f37fceef1bd7a5e8df7f55abbbf6051f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E6=9C=9D=E9=98=B3?= Date: Thu, 18 May 2023 20:40:41 +0800 Subject: [PATCH] fix: when request access_token is post method, http body has no json data --- apps/authentication/backends/oauth2/backends.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/authentication/backends/oauth2/backends.py b/apps/authentication/backends/oauth2/backends.py index 2214ba628..9f3b04ac3 100644 --- a/apps/authentication/backends/oauth2/backends.py +++ b/apps/authentication/backends/oauth2/backends.py @@ -104,7 +104,10 @@ class OAuth2Backend(JMSModelBackend): headers = { 'Accept': 'application/json' } - access_token_response = requests_func(access_token_url, headers=headers) + if token_method == 'post': + access_token_response = requests_func(access_token_url, headers=headers, json=query_dict) + else: + access_token_response = requests_func(access_token_url, headers=headers) try: access_token_response.raise_for_status() access_token_response_data = access_token_response.json()