Hi 👋 I work on the VS Code team. I'd like to let you know about a discovery we made around auth and how to use the built-in Microsoft auth with Azure DevOps APIs.
First off, if you aren't familiar with the auth APIs in VS Code, check out our API.
With that said, if you wanted to get an access token to interact with Azure DevOps, all you have to do is:
const session = await vscode.authentication.getSession(
// Specifies the Microsoft Auth Provider
'microsoft',
// This GUID is the Azure DevOps GUID and you basically ask for a token that can be used to interact with AzDO. This is publicly documented all over
['499b84ac-1321-427f-aa17-267ca6975798/.default', 'offline_access'],
{
// be sure to take a look at the other options
createIfNone: true;
});
At this point, session.accessToken is an access token that can be used to query AzDO APIs.
Hi 👋 I work on the VS Code team. I'd like to let you know about a discovery we made around auth and how to use the built-in Microsoft auth with Azure DevOps APIs.
First off, if you aren't familiar with the auth APIs in VS Code, check out our API.
With that said, if you wanted to get an access token to interact with Azure DevOps, all you have to do is:
At this point,
session.accessToken
is an access token that can be used to query AzDO APIs.No more PAT creation for the user!
What do you think?