pushed_authorization_request sends list authorization_details as a Python repr
维护者通常 1 天内回复
评估
调研方向
从PushedAuthorizationRequests.pushed_authorization_request()以及 issue 中提到的现有测试test_with_authorization_details开始。比较RestClient._request()对列表值的编码方式与 #695 中BackChannelLogin.back_channel_login()的修复。传入列表时,如果表单正文将authorization_details包含为带双引号的 JSON 数组,就表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 578
- 派生
- 190
- 平均合并
- 9 小时 39 分钟
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
auth0/auth0-python 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
auth0/auth0-python#852 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 68/100
auth0/auth0-python#856 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 52/100
auth0/auth0-python#798 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 45/100
auth0/auth0-python#789 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 auth0/auth0-python 的全部 Issue
相似的 Issue
-
comp/tools P2 type/bug
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#142908 · 1 条评论 ·
-
[oblt-aw][autodoc] Fix malformed headings in new Buildkite docs pages可能已有人在做 @github-actions 今天认领。 未关闭documentation
难度 1/5 1 小时以内 新手友好度 83/100
维护者通常 1 天内回复
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offline可能已有人在做 @r2jaff 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
ComposioHQ/composio#5054 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
pytorch/tensordict#3286 ·
维护者通常 1 天内回复