Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

pushed_authorization_request sends list authorization_details as a Python repr

未關閉 適合新手
#903 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@RaphaelFakhri 已經在處理了。

開始於 2026年10月19日。

  • #904 來自 @RaphaelFakhri —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
api

研究方向

從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

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

auth0/auth0-python 的其他 Issue

查看 auth0/auth0-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。