Test: Proposed API getAccounts
API & AuthenticationProvider
changes
#216836
Labels
Milestone
getAccounts
API & AuthenticationProvider
changes
#216836
Refs: #152399
Complexity: 5
Create Issue
This iteration we've moved away from the previous proposed
getSessions
API... to something that separates the concept of "Accounts" and "Sessions".An "Account" is basically an identity, without access to anything. It just says who you are... while a "Session", on the other hand, has an
accessToken
that can access whatever scopes were requested. This also means that the concept ofscopes
doesn't matter to an "Account"... and scopes only matter to "session".Put plainly, 1 account can have multiple sessions tied to it.
Next context! An
AuthenticationProvider
can be marked as supporting only 1 account or multiple accounts at a time. For this TPI, it's really only applicable when you support multiple accounts so make sure you do that.Alright, enough chat... let's test.
Prereqs
npx @vscode/dts dev
to get the proposed API fileImplement an Authentication Provider
You'll want to:
authentication
contribution section of the package.jsonYou can absolutely attempt to implement a full auth provider if you'd like... I'm not gonna stop you :) Here's what my Spotify one looks like (but it's not multi-account).
But it's not necessary. Having
getSessions
andcreateSession
return dummy data is totally fine for this TPI. Just make sure you test having it:createSession
to run)The important part is having
getSessions
andcreateSession
take in the new:and do something with it. This property will be used to filter down the list of sessions we have to only the account passed in or used to create a session specific to that account.
Once you have an Auth Provider, it's time to use it.
Implement something that uses the new
getAccounts
& additions togetSession
APINow time for the consumer! (you can do this in the same extension via a Command or something)
Play around with the
vscode.authentication.getAccounts
API which should return all accounts that you are logged in to.Additionally, play around with passing an account returned by that API into
vscode.authentication.getSession
via the options.The text was updated successfully, but these errors were encountered: