matrix-org / matrix-org/matrix-python-sdk

Registration fails "An access token should not be provided on requests to /register"

Aperta
#323 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
266
Fork
118
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in matrix_client/api.py dalle chiamate a _send e register mostrate nel traceback, quindi esamina il percorso register_with_password di matrix_client/client.py e i test esistenti per gli account guest. Riproduci la richiesta di registrazione e conferma che abbia esito positivo senza un access token; aggiungi la copertura per la registrazione con password insieme ai test attuali.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, authentication
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.