synapse icon indicating copy to clipboard operation
synapse copied to clipboard

When submitting a wrong token to validate a phone number the error is not correct

Open bmarty opened this issue 5 years ago • 5 comments

When adding a phone number to an account, the user receive a submit_url in the response, and also a text message on the phone with a token composed by 6 digits.

When submitting a wrong token with

curl -X POST --data $'{"client_secret":"8f4285f7-ace9-4645-b545-e55e0566ab07","sid":"821337013","token":"111111"}' \
-H "Authorization: Bearer MDAxOGxvY2F0aW9uIG1hdHJp_REDACTED" \
'https://matrix-client.matrix.org/_matrix/client/unstable/add_threepid/msisdn/submit_token'

The user receive an error 400 with the following body:

{
  "errcode": "M_UNKNOWN",
  "error": "Error contacting the identity server"
}

The errcode should be more specific for instance "M_INVALID_TOKEN" (see https://github.com/matrix-org/sydent/issues/292) and the error value is really confusing, because there is no identity server at all on the loop.

bmarty avatar Aug 31 '20 20:08 bmarty

the error value is really confusing, because there is no identity server at all on the loop.

Just to give more context around this, there is an IS in the loop as Synapse delegates MSISDN validation to Sydent (as it doesn't know how to do it.

I think the next step is to change the Synapse code so that it forwards the error from the identity server.

babolivier avatar Sep 01 '20 14:09 babolivier

I'm afraid we've got too much customer work going on at the moment to be able to prioritise this. Let us know if it's a big issue for you and we can reconsider

richvdh avatar Sep 03 '20 13:09 richvdh

This is not a big issue, and Element Android understands the error response correctly, so there is no rush.

bmarty avatar Sep 03 '20 16:09 bmarty

@babolivier from client POV there is no identity server on the loop :). Internal delegation should stay internal.

bmarty avatar Sep 03 '20 16:09 bmarty

Yes, that makes sense, I was just giving more context to explain why the error message is currently like that :)

babolivier avatar Sep 03 '20 17:09 babolivier