diff --git a/src/base-apis.js b/src/base-apis.js index 68fc137a7..79ad92c87 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -1731,6 +1731,10 @@ MatrixBaseApis.prototype.getKeyChanges = function(oldToken, newToken) { * @return {module:http-api.MatrixError} Rejects: with an error response. */ MatrixBaseApis.prototype.registerWithIdentityServer = function(hsOpenIdToken) { + if (!this.idBaseUrl) { + throw new Error("No Identity Server base URL set"); + } + const uri = this.idBaseUrl + httpApi.PREFIX_IDENTITY_V2 + "/account/register"; return this._http.requestOtherUrl( undefined, "POST", uri, diff --git a/src/http-api.js b/src/http-api.js index 7853ea18f..2b083a3e5 100644 --- a/src/http-api.js +++ b/src/http-api.js @@ -389,6 +389,10 @@ module.exports.MatrixHttpApi.prototype = { prefix, accessToken, ) { + if (!this.opts.idBaseUrl) { + throw new Error("No Identity Server base URL set"); + } + const fullUri = this.opts.idBaseUrl + prefix + path; if (callback !== undefined && !utils.isFunction(callback)) {