Fix Single Sign-on

https://github.com/matrix-org/matrix-react-sdk/pull/2826 checked
that we had data in the crypto store if the had credentials in
localStorage. However, SSO stores creds in localStorage and then
redirects the browser to remove the loginToken parameter from the
URL without starting crypto, so after the redirect, we see creds
in localStorage but no crypto data, and error.

Fix by marking when we've successfully initialised crypto and only
erroring if that flag is set.

Fixes https://github.com/vector-im/riot-web/issues/9695
This commit is contained in:
David Baker 2019-05-15 13:47:48 +01:00
parent 66aabdca9e
commit da1bff1c5d
3 changed files with 22 additions and 3 deletions

View file

@ -121,6 +121,7 @@ class MatrixClientPeg {
// check that we have a version of the js-sdk which includes initCrypto
if (this.matrixClient.initCrypto) {
await this.matrixClient.initCrypto();
StorageManager.setCryptoInitialised(true);
}
} catch (e) {
if (e && e.name === 'InvalidCryptoStoreError') {