8000 Fix: Unauthorized Access Error For PAR by kishore7snehil · Pull Request #671 · auth0/auth0-python · GitHub
[go: up one dir, main page]

Skip to content

Fix: Unauthorized Access Error For PAR #671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Making the logic unit test compatible
  • Loading branch information
kishore7snehil committed Feb 12, 2025
commit d8e14f8d431160f7b93c728c50f3bcfde0992a5f
7 changes: 3 additions & 4 deletions auth0/authentication/pushed_authorization_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from .base import AuthenticationBase

from urllib.parse import urlencode


class PushedAuthorizationRequests(AuthenticationBase):
Expand All @@ -23,14 +22,14 @@ def pushed_authorization_request(

See: https://www.rfc-editor.org/rfc/rfc9126.html
"""
return self.post(
return self.authenticated_post(
f"{self.protocol}://{self.domain}/oauth/par",
data=urlencode({
data={
"client_id":self.client_id,
"client_secret":self.client_secret,
"response_type": response_type,
"redirect_uri": redirect_uri,
**kwargs,
}),
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
3 changes: 2 additions & 1 deletion auth0/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from random import randint
from time import sleep
from typing import TYPE_CHECKING, Any, Mapping
from urllib.parse import urlencode

import requests

Expand Down Expand Up @@ -155,8 +156,8 @@
if data is None and json is not None and headers:
content_type = headers.get("Content-Type", "").lower() # Get Content-Type
if "application/x-www-form-urlencoded" in content_type:
data = json # Copy JSON data into data
data = urlencode(json) # Copy JSON data into data
json = None # Prevent JSON from being sent

Check warning on line 160 in auth0/rest.py

View check run for this annotation

Codecov / codecov/patch

auth0/rest.py#L159-L160

Added lines #L159 - L160 were not covered by tests

kwargs = {
k: v
Expand Down
0