From 8c15125e238cf6d3115f773d461d49fe96d46e31 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" <jryans@gmail.com> Date: Thu, 8 Aug 2019 10:29:14 +0100 Subject: [PATCH] Fix POST body for v2 IS requests POST bodies for v2 IS requests must be sent as JSON. Part of https://github.com/vector-im/riot-web/issues/10159 --- src/base-apis.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base-apis.js b/src/base-apis.js index c3b2adddfdc..02d3984dad1 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -1769,7 +1769,8 @@ MatrixBaseApis.prototype.requestEmailToken = async function( try { const response = await this._http.idServerRequest( undefined, "POST", "/validate/email/requestToken", - params, httpApi.PREFIX_IDENTITY_V2, identityAccessToken, + JSON.stringify(params), httpApi.PREFIX_IDENTITY_V2, + identityAccessToken, ); // TODO: Fold callback into above call once v1 path below is removed if (callback) callback(null, response); @@ -1824,7 +1825,8 @@ MatrixBaseApis.prototype.submitMsisdnToken = async function( try { return await this._http.idServerRequest( undefined, "POST", "/validate/msisdn/submitToken", - params, httpApi.PREFIX_IDENTITY_V2, identityAccessToken, + JSON.stringify(params), httpApi.PREFIX_IDENTITY_V2, + identityAccessToken, ); } catch (err) { if (err.cors === "rejected" || err.httpStatus === 404) {