Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3178 from matrix-org/dbkr/delint_scalar_auth_client
Browse files Browse the repository at this point in the history
De-lint ScalarAuthClient
  • Loading branch information
dbkr authored Jul 4, 2019
2 parents 3f28f2e + 7d40ccf commit 2b5d996
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion .eslintignore.errorfiles
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ src/rageshake/submit-rageshake.js
src/ratelimitedfunc.js
src/Roles.js
src/Rooms.js
src/ScalarAuthClient.js
src/UiEffects.js
src/Unread.js
src/utils/DecryptFile.js
Expand Down
18 changes: 9 additions & 9 deletions src/ScalarAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ class ScalarAuthClient {

registerForToken() {
// Get openid bearer token from the HS as the first part of our dance
return MatrixClientPeg.get().getOpenIdToken().then((token_object) => {
return MatrixClientPeg.get().getOpenIdToken().then((tokenObject) => {
// Now we can send that to scalar and exchange it for a scalar token
return this.exchangeForScalarToken(token_object);
}).then((token_object) => {
window.localStorage.setItem("mx_scalar_token", token_object);
return token_object;
return this.exchangeForScalarToken(tokenObject);
}).then((tokenObject) => {
window.localStorage.setItem("mx_scalar_token", tokenObject);
return tokenObject;
});
}

exchangeForScalarToken(openid_token_object) {
const scalar_rest_url = SdkConfig.get().integrations_rest_url;
exchangeForScalarToken(openidTokenObject) {
const scalarRestUrl = SdkConfig.get().integrations_rest_url;

return new Promise(function(resolve, reject) {
request({
method: 'POST',
uri: scalar_rest_url+'/register',
uri: scalarRestUrl + '/register',
qs: {v: imApiVersion},
body: openid_token_object,
body: openidTokenObject,
json: true,
}, (err, response, body) => {
if (err) {
Expand Down

0 comments on commit 2b5d996

Please sign in to comment.