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

Not sure what is clearSessionPreference option does #104080

Closed
sandy081 opened this issue Aug 5, 2020 · 2 comments
Closed

Not sure what is clearSessionPreference option does #104080

sandy081 opened this issue Aug 5, 2020 · 2 comments
Assignees
Labels
authentication Issues with the Authentication platform bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue verified Verification succeeded
Milestone

Comments

@sandy081
Copy link
Member

sandy081 commented Aug 5, 2020

Testing #103871

I am sorry that I have no clue what is this parameter is for, hence creating the issue.

/**
 * Whether the existing user session preference should be cleared. Set to allow the user to switch accounts.
 * Defaults to false.
 */
clearSessionPreference?: boolean;

I tried to use it in GitHub sample but not sure what is happening when I set this parameter.

const session = await vscode.authentication.getSession(GITHUB_AUTH_PROVIDER_ID, SCOPES, { clearSessionPreference: true });

Does this clear current session and creates new session?

@RMacfarlane
Copy link
Contributor

RMacfarlane commented Aug 5, 2020

Ah, yeah, this is confusing especially with GitHub because it doesn't change anything there.

The GitHub auth provider only supports being signed into one account at a time, but you can be signed into many Microsoft accounts at at time. If you call getSession for the first time and there are matching sessions, a quickpick is shown asking if you want to use one of those accounts, or sign into a different account. The preference for that session is stored for that extension, so it keeps getting back that account on subsequent calls to getSession. This flag is meant to provide a way for an extension to expose a "switch account" sort of command, otherwise the user will never be able to use a different account with that extension.

I'll add more information in the comment

@RMacfarlane RMacfarlane added bug Issue identified by VS Code Team member as probable bug polish Cleanup and polish issue authentication Issues with the Authentication platform labels Aug 5, 2020
@RMacfarlane RMacfarlane added this to the July 2020 milestone Aug 5, 2020
@sandy081 sandy081 added the verified Verification succeeded label Aug 6, 2020
@sandy081
Copy link
Member Author

sandy081 commented Aug 6, 2020

Thanks for explanation.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
authentication Issues with the Authentication platform bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants
@RMacfarlane @sandy081 and others