Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a way to force recreation of a specific session #177263

Closed
TylerLeonhardt opened this issue Mar 15, 2023 · 3 comments
Closed

Need a way to force recreation of a specific session #177263

TylerLeonhardt opened this issue Mar 15, 2023 · 3 comments
Assignees
Labels
api api-proposal authentication Issues with the Authentication platform feature-request Request for new features or functionality

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 15, 2023

So in API Sync yesterday, @joyceerhl brought up a really good point on my getSessions API proposal… the issue is that it is possible to get back all of these accounts, but there is no way to say that a specific account is bad.

Currently we have this:

await vscode.authentication.getSession('github', scopes, { forceNewSession: true })

// or

await vscode.authentication.getSession('github', scopes, { forceNewSession: { detail: 'because SAML is a pain' }})

but that only forces recreation of the session for the account that has preference and doesn’t allow for specifying a specific account to recreate… so with that, we have a couple ideas:

interface AuthenticationForceNewSessionOptions {
  detail?: string;
  accountId?: string;
}

or

interface AuthenticationForceNewSessionOptions {
  detail?: string;
  account?: AuthenticationSessionAccountInformation;
}

or even

interface AuthenticationForceNewSessionOptions {
  detail?: string;
  session?: AuthenticationSession;
}

one of which will then go here:

await vscode.authentication.getSession('github', scopes, { forceNewSession: obj })

and will take the user through the flow to create a new session for the account and scopes provided.

Some helpful dts links:

@TylerLeonhardt TylerLeonhardt added feature-request Request for new features or functionality api api-proposal authentication Issues with the Authentication platform labels Mar 15, 2023
@TylerLeonhardt TylerLeonhardt added this to the March 2023 milestone Mar 15, 2023
@TylerLeonhardt TylerLeonhardt self-assigned this Mar 15, 2023
@TylerLeonhardt TylerLeonhardt modified the milestones: March 2023, April 2023 Mar 20, 2023
@TylerLeonhardt
Copy link
Member Author

New idea is to allow getSession to take in an accountHint which an auth provider can opt in to supporting.:

declare module 'vscode' {
	export interface AuthenticationProviderOptions {
		/**
		 * Whether the provider supports the concept of an account hint.
		 */
		readonly supportsAccountHint?: boolean;
	}
	export interface AuthenticationGetSessionOptions {
		/**
		 * An account hint to use when getting a session.
		 */
		readonly accountHint?: string;
	}
}

Then the caller can pass in a hint like an account id or an email address and the provider can interpret that and use that in deciding which session getSession will return.

@TylerLeonhardt
Copy link
Member Author

Additionally, we consider the proposal in #115626 ... which would allow the caller to pass down anything to the provider to determine the session to return back.

@TylerLeonhardt
Copy link
Member Author

We're going to merge this in with #152399

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-proposal authentication Issues with the Authentication platform feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

1 participant