1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Send id_access_token to HS for use in proxied IS requests

This passes along the `id_access_token` to the HS, which it will need when
speaking v2 IS APIs to the IS.

Unfortunately, some HSes seem to explode when given this new parameter, so we
only pass it along for the moment if an unstable feature `m.id_access_token` is
also set.

Part of https://github.com/vector-im/riot-web/issues/10525
Defined in MSC2140
This commit is contained in:
J. Ryan Stinnett
2019-08-22 14:31:41 +01:00
parent 898fa0e41b
commit 31e72efc91
2 changed files with 65 additions and 5 deletions

View File

@@ -63,6 +63,14 @@ function termsUrlForService(serviceType, baseUrl) {
*
* @param {string} opts.accessToken The access_token for this user.
*
* @param {Function} [opts.getIdentityAccessToken]
* Optional. A callback that returns a Promise<String> of an identity access
* token to supply with identity requests. If the callback is unset, no access
* token will be supplied.
* See also https://github.com/vector-im/riot-web/issues/10615 which seeks to
* replace the previous approach of manual access tokens params with this
* callback throughout the SDK.
*
* @param {Number=} opts.localTimeoutMs Optional. The default maximum amount of
* time to wait before timing out HTTP requests. If not specified, there is no
* timeout.
@@ -79,6 +87,7 @@ function MatrixBaseApis(opts) {
this.baseUrl = opts.baseUrl;
this.idBaseUrl = opts.idBaseUrl;
this.getIdentityAccessToken = opts.getIdentityAccessToken;
const httpOpts = {
baseUrl: opts.baseUrl,