From 8d667f9367cb3c90decb7da022e3719f46842445 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 25 Sep 2019 14:59:32 +0100 Subject: [PATCH] Remove id_server from creds for interactive auth For HSes that do not require an IS, we can remove `id_server` from the auth params. Fixes https://github.com/vector-im/riot-web/issues/10959 --- src/interactive-auth.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/interactive-auth.js b/src/interactive-auth.js index 57f164bd1..cc4fabc22 100644 --- a/src/interactive-auth.js +++ b/src/interactive-auth.js @@ -174,16 +174,19 @@ InteractiveAuth.prototype = { // The email can be validated out-of-band, but we need to provide the // creds so the HS can go & check it. if (this._emailSid) { - const idServerParsedUrl = url.parse( - this._matrixClient.getIdentityServerUrl(), - ); + const creds = { + sid: this._emailSid, + client_secret: this._clientSecret, + }; + if (await this._matrixClient.doesServerRequireIdServerParam()) { + const idServerParsedUrl = url.parse( + this._matrixClient.getIdentityServerUrl(), + ); + creds.id_server = idServerParsedUrl.host; + } authDict = { type: EMAIL_STAGE_TYPE, - threepid_creds: { - sid: this._emailSid, - client_secret: this._clientSecret, - id_server: idServerParsedUrl.host, - }, + threepid_creds: creds, }; } }