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