Merge pull request #4191 from matrix-org/travis/remove-v1-identity

Remove v1 identity server fallbacks
This commit is contained in:
Travis Ralston 2020-03-10 09:30:24 -06:00 committed by GitHub
commit 9b62cc964b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -181,24 +181,12 @@ export default class IdentityAuthClient {
} }
async registerForToken(check=true) { async registerForToken(check=true) {
try { const hsOpenIdToken = await MatrixClientPeg.get().getOpenIdToken();
const hsOpenIdToken = await MatrixClientPeg.get().getOpenIdToken(); // XXX: The spec is `token`, but we used `access_token` for a Sydent release.
// XXX: The spec is `token`, but we used `access_token` for a Sydent release. const { access_token: accessToken, token } =
const { access_token: accessToken, token } = await this._matrixClient.registerWithIdentityServer(hsOpenIdToken);
await this._matrixClient.registerWithIdentityServer(hsOpenIdToken); const identityAccessToken = token ? token : accessToken;
const identityAccessToken = token ? token : accessToken; if (check) await this._checkToken(identityAccessToken);
if (check) await this._checkToken(identityAccessToken); return identityAccessToken;
return identityAccessToken;
} catch (e) {
if (e.cors === "rejected" || e.httpStatus === 404) {
// Assume IS only supports deprecated v1 API for now
// TODO: Remove this path once v2 is only supported version
// See https://github.com/vector-im/riot-web/issues/10443
console.warn("IS doesn't support v2 auth");
this.authEnabled = false;
return;
}
throw e;
}
} }
} }