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 22
33from .base import AuthenticationBase
44
5+ from urllib .parse import urlencode
6+
57
68class PushedAuthorizationRequests (AuthenticationBase ):
79 """Pushed Authorization Request (PAR) endpoint"""
@@ -21,12 +23,14 @@ def pushed_authorization_request(
2123
2224 See: https://www.rfc-editor.org/rfc/rfc9126.html
2325 """
24- return self .authenticated_post (
26+ return self .post (
2527 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 ,
2831 "response_type" : response_type ,
2932 "redirect_uri" : redirect_uri ,
3033 ** 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(
152152 # Reset the metrics tracker
153153 self ._metrics = {"retries" : 0 , "backoff" : []}
154154
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+
155161 kwargs = {
156162 k : v
157163 for k , v in {
You can’t perform that action at this time.
0 commit comments