From 0ab9efc594f7918851fa55d579e9ecf4c825892c Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 23 Sep 2019 12:28:41 +0100 Subject: [PATCH] Delay IS access tokens --- src/AddThreepid.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/AddThreepid.js b/src/AddThreepid.js index 84fa07ff4b..8f19815210 100644 --- a/src/AddThreepid.js +++ b/src/AddThreepid.js @@ -200,7 +200,6 @@ export default class AddThreepid { */ async haveMsisdnToken(msisdnToken) { const authClient = new IdentityAuthClient(); - const identityAccessToken = await authClient.getAccessToken(); let result; if (this.submitUrl) { @@ -215,7 +214,7 @@ export default class AddThreepid { this.sessionId, this.clientSecret, msisdnToken, - identityAccessToken, + await authClient.getAccessToken(), ); } if (result.errcode) { @@ -225,13 +224,11 @@ export default class AddThreepid { const identityServerDomain = MatrixClientPeg.get().idBaseUrl.split("://")[1]; if (await MatrixClientPeg.get().doesServerSupportSeparateAddAndBind()) { if (this.bind) { - const authClient = new IdentityAuthClient(); - const identityAccessToken = await authClient.getAccessToken(); await MatrixClientPeg.get().bindThreePid({ sid: this.sessionId, client_secret: this.clientSecret, id_server: identityServerDomain, - id_access_token: identityAccessToken, + id_access_token: await authClient.getAccessToken(), }); } else { await MatrixClientPeg.get().addThreePidOnly({