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

getSession scope #117512

Closed
roblourens opened this issue Feb 24, 2021 · 4 comments
Closed

getSession scope #117512

roblourens opened this issue Feb 24, 2021 · 4 comments
Assignees

Comments

@roblourens
Copy link
Member

Testing #117299

I don't totally understand how the scope list passed to getSession works. If it ends up calling createSession then it passes the scope there, which makes sense. But if clearSessionPreference is not set, and there is already a session for this auth provider, then it is returned whether or not it has the scopes that getSession requested.

If clearSessionPreference is set, and there are multiple accounts, then I get to pick an account that may or may not have the scopes that the extension requested.

What is the extension supposed to do if it gets a session that doesn't have the scope it needs?

@RMacfarlane
Copy link
Contributor

Ah, the scope list is intended to act as a filter, so the return of getSessions should be only sessions that match those scopes. I'll try to make that clearer in the docs, but that's what should ensure that a call to getSession returns something with the right scopes.

Internally, when some other extension calls getSession, VSCode requests sessions from the provider that match those scopes, and then decides what to do with those matching sessions. If there's already a user preference for one it gets returned automatically, otherwise the quickpick is shown. So if clearSessionPreference is set, the options there are meant to already be filtered to the correct scopes

@RMacfarlane
Copy link
Contributor

Do you think changing the param name to scopesFilter would help?

@roblourens
Copy link
Member Author

I didn't realize that getSessions takes a parameter, because it didn't show up when I used the TS quick fix "implement interface". Not sure what happened there... That makes sense now, and the doc makes sense.

@roblourens
Copy link
Member Author

Ok I think that I used "implement interface" on an old version of the API, then updated vscode.d.ts, then patched it up manually, so I never saw the parameter. Anyway, it's all good.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants