ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)
GNU Affero General Public License v3.0
167 stars 55 forks source link

Missing 3PIDs in riot-web #48

Open rootuser opened 4 years ago

rootuser commented 4 years ago

I would like to point out a problem that may be due to a bug in ma1sd.

The original issue was first reported in the riot-web bug list, see here: https://github.com/vector-im/riot-web/issues/13033#

In short, the problem is that no 3PIDs are shown in the settings page of riot-web, as well as in riotX Android app. In the old riot Android app, 3PIDs are shown though.

When I noticed the followin error in the browsers javascript console:

Access to XMLHttpRequest at 'https://matrix.mydomain.de/_matrix/identity/v2/account/register' from origin 'https://riot.mydomain.de' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

it seemed to me the problem might be caused by a wrongly configured reverse proxy.

I contacted the developer of matrix-docker-ansible-deploy, as my installation is done via his script. You can find my report in his issue list at https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/505

It turned out that when riot-web accessed the identity server, an Access-Control-Allow-Origin header was missing, which denied access. This problem was finally fixed, see https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/511

The reason why I am addressing you is that the absence of the old bug now reveals a new one: in the current version I get the message: Unable to reach identity server at https://matrix.mydomain.de to check for 3PIDs bindings in Settings Error: Unsupported identity server: bad response

Since I use ma1sd as identity server and since e.g. the login works without problems I wonder if the described behaviour might be a bug in ma1sd.

It would be great if you could comment on this.

Best, Tom

ma1uta commented 4 years ago

Hello. Sorry for the late answer.

I double checked the code and ma1sd always return CORS headers.

I think this issue occurs because V2 API was disabled in the previous version. In the next release V2 will be enabled by default. Lets check again after the release.

jmastr commented 4 years ago

@ma1uta I am using ma1sd v2.4.0 with V2 enabled, but the problem still persists. Any ideas how I could debug it?

jmastr commented 4 years ago

@rootuser @ma1uta I think I pinned down the problem to the now unmaintained https://github.com/kamax-matrix/matrix-synapse-rest-password-provider and more precisely to:

https://github.com/kamax-matrix/matrix-synapse-rest-password-provider/blob/d99b856cd91443ecd468b51bb581afdace82db99/rest_auth_provider.py#L102

I can see from my logs that it never actually adds the 3PID to the database. This because of a change in synapse:

https://github.com/matrix-org/synapse/commit/e91abfd2919bcd42322099ecca8387a2dae9b06e

-            user_id = yield self.hs.get_datastore().get_user_id_by_threepid(
+            user_id = await self.hs.get_datastore().get_user_id_by_threepid(

Since the matrix-synapse-rest-password-provider is now read-only I don't see a way to file a PR. I will change to matrix-synapse-ldap3 for now, hoping that 3PID work there.

ma1uta commented 4 years ago

matrix-synapse-rest-password-provider was forked in the https://github.com/ma1uta/matrix-synapse-rest-password-provider, feel free to create a PR.

pixel1138 commented 4 years ago

I was able to get 3pids to show up again in the webapp after enabling hashing according to this document: https://github.com/ma1uta/ma1sd/blob/master/docs/MSC2140_MSC2134.md