You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Change to provider object
This commit is contained in:
@@ -63,10 +63,11 @@ function termsUrlForService(serviceType, baseUrl) {
|
|||||||
*
|
*
|
||||||
* @param {string} opts.accessToken The access_token for this user.
|
* @param {string} opts.accessToken The access_token for this user.
|
||||||
*
|
*
|
||||||
* @param {Function} [opts.getIdentityAccessToken]
|
* @param {IdentityServerProvider} [opts.identityServer]
|
||||||
* Optional. A callback that returns a Promise<String> of an identity access
|
* Optional. A provider object with one function `getAccessToken`, which is a
|
||||||
* token to supply with identity requests. If the callback is unset, no access
|
* callback that returns a Promise<String> of an identity access token to supply
|
||||||
* token will be supplied.
|
* with identity requests. If the object is unset, no access token will be
|
||||||
|
* supplied.
|
||||||
* See also https://github.com/vector-im/riot-web/issues/10615 which seeks to
|
* 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
|
* replace the previous approach of manual access tokens params with this
|
||||||
* callback throughout the SDK.
|
* callback throughout the SDK.
|
||||||
@@ -87,7 +88,7 @@ function MatrixBaseApis(opts) {
|
|||||||
|
|
||||||
this.baseUrl = opts.baseUrl;
|
this.baseUrl = opts.baseUrl;
|
||||||
this.idBaseUrl = opts.idBaseUrl;
|
this.idBaseUrl = opts.idBaseUrl;
|
||||||
this.getIdentityAccessToken = opts.getIdentityAccessToken;
|
this.identityServer = opts.identityServer;
|
||||||
|
|
||||||
const httpOpts = {
|
const httpOpts = {
|
||||||
baseUrl: opts.baseUrl,
|
baseUrl: opts.baseUrl,
|
||||||
|
|||||||
@@ -108,10 +108,11 @@ function keyFromRecoverySession(session, decryptionKey) {
|
|||||||
*
|
*
|
||||||
* @param {string} opts.userId The user ID for this user.
|
* @param {string} opts.userId The user ID for this user.
|
||||||
*
|
*
|
||||||
* @param {Function} [opts.getIdentityAccessToken]
|
* @param {IdentityServerProvider} [opts.identityServer]
|
||||||
* Optional. A callback that returns a Promise<String> of an identity access
|
* Optional. A provider object with one function `getAccessToken`, which is a
|
||||||
* token to supply with identity requests. If the callback is unset, no access
|
* callback that returns a Promise<String> of an identity access token to supply
|
||||||
* token will be supplied.
|
* with identity requests. If the object is unset, no access token will be
|
||||||
|
* supplied.
|
||||||
* See also https://github.com/vector-im/riot-web/issues/10615 which seeks to
|
* 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
|
* replace the previous approach of manual access tokens params with this
|
||||||
* callback throughout the SDK.
|
* callback throughout the SDK.
|
||||||
@@ -2471,10 +2472,11 @@ MatrixClient.prototype.inviteByThreePid = async function(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.getIdentityAccessToken &&
|
this.identityServer &&
|
||||||
|
this.identityServer.getAccessToken &&
|
||||||
await this.doesServerAcceptIdentityAccessToken()
|
await this.doesServerAcceptIdentityAccessToken()
|
||||||
) {
|
) {
|
||||||
const identityAccessToken = await this.getIdentityAccessToken();
|
const identityAccessToken = await this.identityServer.getAccessToken();
|
||||||
if (identityAccessToken) {
|
if (identityAccessToken) {
|
||||||
params.id_access_token = identityAccessToken;
|
params.id_access_token = identityAccessToken;
|
||||||
}
|
}
|
||||||
@@ -3458,10 +3460,11 @@ MatrixClient.prototype._requestTokenFromEndpoint = async function(endpoint, para
|
|||||||
postParams.id_server = idServerUrl.host;
|
postParams.id_server = idServerUrl.host;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.getIdentityAccessToken &&
|
this.identityServer &&
|
||||||
|
this.identityServer.getAccessToken &&
|
||||||
await this.doesServerAcceptIdentityAccessToken()
|
await this.doesServerAcceptIdentityAccessToken()
|
||||||
) {
|
) {
|
||||||
const identityAccessToken = await this.getIdentityAccessToken();
|
const identityAccessToken = await this.identityServer.getAccessToken();
|
||||||
if (identityAccessToken) {
|
if (identityAccessToken) {
|
||||||
postParams.id_access_token = identityAccessToken;
|
postParams.id_access_token = identityAccessToken;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user