matrix-org / matrix-org/matrix-python-sdk
Registration fails "An access token should not be provided on requests to /register"
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 266
- 派生
- 118
- PR 合并指标
- 30 天内没有已合并 PR
描述
Describe the bug
Trying to register a new account fails with "An access token should not be provided on requests to /register (except if type is m.login.application_service)", although no token was ever set.
To Reproduce
from matrix_client.client import MatrixClient
matrix = MatrixClient("${homeserverUrl}")
matrix.register_with_password(username="alice", password="foobar")
Expected behavior
Login works fine
Actual behavior
Client side:
Traceback (most recent call last):
File "test.py", line 3, in <module>
matrix.register_with_password(username="alice", password="foobar")
File "/lib/python3.9/site-packages/matrix_client/client.py", line 203, in register_with_password
response = self.api.register(
File "/lib/python3.9/site-packages/matrix_client/api.py", line 160, in register
return self._send(
File "/lib/python3.9/site-packages/matrix_client/api.py", line 748, in _send
raise MatrixRequestError(
matrix_client.errors.MatrixRequestError: 400: {"errcode":"M_UNKNOWN","error":"An access token should not be provided on requests to /register (except if type is m.login.application_service)"}
Server side:
[ 104.741510] synapse[1153]: synapse.http.server: [POST-1] <SynapseRequest at 0x7fc64ed887f0 method='POST' uri='/_matrix/client/r0/register?kind=user' clientproto='HTTP/1.1' site='8448'> SynapseError: 400 - An access token should not be provided on requests to /register (except if type is m.login.application_service)
[ 104.753403] synapse[1153]: synapse.access.http.8448: [POST-1] ::ffff:192.168.1.2 - 8448 - {None} Processed request: 0.010sec/-0.000sec (0.001sec, 0.001sec) (0.000sec/0.000sec/0) 140B 400 "POST /_matrix/client/r0/register?kind=user HTTP/1.1" "matrix-python-sdk/0.4.0" [0 dbevts]
Additional context
This is probably a regression in 0.4.0 related to the addition of use_authorization_header. Also the tests currently only test the creation of guest accounts.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 matrix_client/api.py 中 traceback 所示的 _send 和 register 调用开始,然后检查 matrix_client/client.py 的 register_with_password 路径以及现有的 guest-account 测试。重现注册请求,并确认其在没有 access token 的情况下能够成功;在当前测试旁补充密码注册的覆盖测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api, authentication
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100