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

Commit

Permalink
Redirect starter links to the desired integration manager
Browse files Browse the repository at this point in the history
When not using Scalar for the integrations manager, the scalar_token in Riot may not be valid for scalar.vector.im, leading to authentication problems. Starter links should instead point to the desired integrations manager where the token is more likely to be valid.

Signed-off-by: Travis Ralston <travpc@gmail.com>
  • Loading branch information
turt2live committed Aug 26, 2017
1 parent 6077693 commit 909b293
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ScalarAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class ScalarAuthClient {
}

getStarterLink(starterLinkUrl) {
// If the starter link points to Scalar, but the integrations manager isn't scalar, redirect accordingly.
// The integration manager is responsible for maintaining the starter link route.
let scalarUrl = SdkConfig.get().integrations_rest_url;
if (!starterLinkUrl.startsWith(scalarUrl) && starterLinkUrl.startsWith("https://scalar.vector.im/api"))
starterLinkUrl = scalarUrl + starterLinkUrl.substring("https://scalar.vector.im/api".length);
return starterLinkUrl + "?scalar_token=" + encodeURIComponent(this.scalarToken);
}
}
Expand Down

0 comments on commit 909b293

Please sign in to comment.