pushed_authorization_request sends list authorization_details as a Python repr
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Beginne mit PushedAuthorizationRequests.pushed_authorization_request() und dem bestehenden Test test_with_authorization_details, der im Issue genannt wird. Vergleiche, wie RestClient._request() Listenwerte kodiert, mit der Korrektur in BackChannelLogin.back_channel_login() in #695. Fertig ist die Änderung, wenn der Formularkörper authorization_details als JSON-Array mit doppelten Anführungszeichen enthält, wenn eine Liste übergeben wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Checklist
- I have looked into the README and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
Description
PushedAuthorizationRequests.pushed_authorization_request() posts a form-encoded body (Content-Type: application/x-www-form-urlencoded). RestClient._request() converts the payload with urllib.parse.urlencode(), which turns a list value into its Python repr.
When you pass authorization_details as a list, which the existing test test_with_authorization_details does, the request body contains:
authorization_details=%5B%7B%27type%27%3A+%27money_transfer%27%2C+...
That decodes to [{'type': 'money_transfer', ...}], with single quotes, which is not JSON. RFC 9396 requires authorization_details to be a JSON array, so RAR through PAR does not work with a list.
BackChannelLogin.back_channel_login() had the same problem and was fixed in #695 by calling json.dumps() on list values.
Reproduction
from unittest import mock
from urllib.parse import parse_qs
from auth0.authentication.pushed_authorization_requests import PushedAuthorizationRequests
with mock.patch("requests.request") as req:
req.return_value.status_code = 201
req.return_value.text = '{"request_uri": "urn:x", "expires_in": 30}'
PushedAuthorizationRequests("my.domain.com", "cid", client_secret="s").pushed_authorization_request(
response_type="code",
redirect_uri="https://example.com/cb",
authorization_details=[{"type": "money_transfer"}],
)
print(parse_qs(req.call_args.kwargs["data"])["authorization_details"])
# ["[{'type': 'money_transfer'}]"]
Expected: ['[{"type": "money_transfer"}]'].
Additional context
Workaround: pass authorization_details=json.dumps([...]).
auth0-python version
6.8.0 (main at 9aae3e5)
Python version
3.12
- Vorherrschende Sprache
- Python
- Sterne
- 578
- Forks
- 190
- Ø Merge
- 9 Std. 39 Min.
- Gemergte PRs (30 T.)
- 7
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus auth0/auth0-python
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
auth0/auth0-python#852 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
auth0/auth0-python#856 · 4 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
auth0/auth0-python#798 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
auth0/auth0-python#789 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in auth0/auth0-python
Ähnliche Issues
-
debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
microsoft/vscode-flake8#601 ·
Maintainer antworten meist innerhalb von 1 Tag
-
nonews refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Uninett/nav#4255 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 3 Tagen
-
namespace operations
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 70/100
EclipseFdn/open-vsx.org#14421 ·
Maintainer antworten meist innerhalb von 1 Tag
-
untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ubuntu/ubuntu-project-docs#850 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag