File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from .base import AuthenticationBase
4
4
5
+ from urllib .parse import urlencode
6
+
5
7
6
8
class PushedAuthorizationRequests (AuthenticationBase ):
7
9
"""Pushed Authorization Request (PAR) endpoint"""
@@ -21,12 +23,14 @@ def pushed_authorization_request(
21
23
22
24
See: https://www.rfc-editor.org/rfc/rfc9126.html
23
25
"""
24
- return self .authenticated_post (
26
+ return self .post (
25
27
f"{ self .protocol } ://{ self .domain } /oauth/par" ,
26
- data = {
27
- "client_id" : self .client_id ,
28
+ data = urlencode ({
29
+ "client_id" :self .client_id ,
30
+ "client_secret" :self .client_secret ,
28
31
"response_type" : response_type ,
29
32
"redirect_uri" : redirect_uri ,
30
33
** kwargs ,
31
- },
32
- )
34
+ }),
35
+ headers = {"Content-Type" : "application/x-www-form-urlencoded" },
36
+ )
Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ def _request(
152
152
# Reset the metrics tracker
153
153
self ._metrics = {"retries" : 0 , "backoff" : []}
154
154
155
+ if data is None and json is not None and headers :
156
+ content_type = headers .get ("Content-Type" , "" ).lower () # Get Content-Type
157
+ if "application/x-www-form-urlencoded" in content_type :
158
+ data = json # Copy JSON data into data
159
+ json = None # Prevent JSON from being sent
160
+
155
161
kwargs = {
156
162
k : v
157
163
for k , v in {
You can’t perform that action at this time.
0 commit comments