diff --git a/plugins/login-resources/src/utils.ts b/plugins/login-resources/src/utils.ts index 76dc085ddf..0f531a72b6 100644 --- a/plugins/login-resources/src/utils.ts +++ b/plugins/login-resources/src/utils.ts @@ -310,7 +310,7 @@ export async function selectWorkspace (workspace: string): Promise<[Status, Work } } - const token = getMetadata(presentation.metadata.Token) + const token = getMetadata(presentation.metadata.Token) ?? fetchMetadataLocalStorage(login.metadata.LastToken) if (token === undefined) { const loc = getCurrentLocation() loc.path[0] = 'login' diff --git a/plugins/workbench-resources/src/connect.ts b/plugins/workbench-resources/src/connect.ts index 90a5126321..aba655ba0a 100644 --- a/plugins/workbench-resources/src/connect.ts +++ b/plugins/workbench-resources/src/connect.ts @@ -67,7 +67,11 @@ export async function connect (title: string): Promise { const tokens: Record = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {} let token = tokens[ws] - if (token === undefined && getMetadata(presentation.metadata.Token) !== undefined) { + if ( + token === undefined && + (getMetadata(presentation.metadata.Token) !== undefined || + fetchMetadataLocalStorage(login.metadata.LastToken) != null) + ) { const selectWorkspace = await getResource(login.function.SelectWorkspace) const loginInfo = await ctx.with('select-workspace', {}, async () => (await selectWorkspace(ws))[1]) if (loginInfo !== undefined) {