From e5d5cd901a542dbc8a3c4600414cb4a3d20f238b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 7 Oct 2016 14:08:28 +0100 Subject: [PATCH] Function to get the fallback url for interactive auth --- lib/base-apis.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/base-apis.js b/lib/base-apis.js index c82301e3c..c53d4043f 100644 --- a/lib/base-apis.js +++ b/lib/base-apis.js @@ -290,6 +290,23 @@ MatrixBaseApis.prototype.deactivateAccount = function(auth, callback) { ); }; +/** + * Get the fallback URL to use for unknown interactive-auth stages. + * + * @param {string} loginType the type of stage being attempted + * @param {string} authSessionId the auth session ID provided by the homeserver + * + * @return {string} HS URL to hit to for the fallback interface + */ +MatrixBaseApis.prototype.getFallbackAuthUrl = function(loginType, authSessionId) { + var path = utils.encodeUri("/auth/$loginType/fallback/web", { + $loginType: loginType, + }); + + return this._http.getUrl(path, { + session: authSessionId, + }, httpApi.PREFIX_R0); +}; // Room operations // ===============