-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
authenticationissues related to authentication (ex: authentication api)issues related to authentication (ex: authentication api)vscodeissues related to VSCode compatibilityissues related to VSCode compatibility
Milestone
Description
Bug Description:
When an AuthenticationProvider restores sessions from stored state (e.g. secrets storage), no changed even may be sent. In this case, the front end is never notified. We should notify the front end of any initial sessions when a authentication provider is registered.
Steps to Reproduce:
- Log in with some authentication provider
- Restart Theia
- Observe the session is active, but you cannot see ti when you click on the little manikin icon at the bottom of the left sidebar: when you click it, it says "You are not logged into any accounts".
Unfortunately, I have no ready scenario to reproduce this: I noticed it with my github login, which you cannot reproduce with the current github-autentication extension (#12821)
Additional Information
Fix in authentication-ext.ts would look like this:
registerAuthenticationProvider(id: string, label: string, provider: theia.AuthenticationProvider, options?: theia.AuthenticationProviderOptions): theia.Disposable {
if (this.authenticationProviders.get(id)) {
throw new Error(`An authentication provider with id '${id}' is already registered.`);
}
this.authenticationProviders.set(id, provider);
provider.getSessions().then(sessions => {
if (sessions.length > 0) {
this.proxy.$onDidChangeSessions(id, {
added: sessions,
removed: [],
changed: []
});
}
});
const listener = provider.onDidChangeSessions(e => {
this.proxy.$onDidChangeSessions(id, e);
});
this.proxy.$registerAuthenticationProvider(id, label, !!options?.supportsMultipleAccounts);
return new Disposable(() => {
listener.dispose();
this.authenticationProviders.delete(id);
this.proxy.$unregisterAuthenticationProvider(id);
});
}
- Operating System:
- Theia Version:
Metadata
Metadata
Assignees
Labels
authenticationissues related to authentication (ex: authentication api)issues related to authentication (ex: authentication api)vscodeissues related to VSCode compatibilityissues related to VSCode compatibility