diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 43c30c94b8..ed14483fb6 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -100,6 +100,7 @@ declare global { mxOnRecaptchaLoaded?: () => void; electron?: Electron; mxSendSentryReport: (userText: string, issueUrl: string, error: Error) => Promise; + mxLoginWithAccessToken: (hsUrl: string, accessToken: string) => Promise; } interface DesktopCapturerSource { diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts index 8477116104..ef7b7b33de 100644 --- a/src/Lifecycle.ts +++ b/src/Lifecycle.ts @@ -538,8 +538,8 @@ export function hydrateSession(credentials: IMatrixClientCreds): Promise => { + const tempClient = createClient({ + baseUrl: hsUrl, + accessToken, + }); + const { user_id: userId } = await tempClient.whoami(); + await doSetLoggedIn({ + homeserverUrl: hsUrl, + accessToken, + userId, + }, true); +}; diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 978939e707..c6da0ed831 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -40,7 +40,7 @@ import { logger } from "matrix-js-sdk/src/logger"; export interface IMatrixClientCreds { homeserverUrl: string; - identityServerUrl: string; + identityServerUrl?: string; userId: string; deviceId?: string; accessToken: string;