1

Are there any possibilities to request a user's global id through the VSS SDK?

I mean it's possible to use IdentitiesClient.readIdentity() with a descriptor for example. But this is going to give an object with an ID that is unique only on the given Collection.

If I'm calling this on an other Collection, it is returning an other id.

By the way in the background this is calling: https://tfshost.com/tfs/_apis/Collection/Identities/System.Security.Principal.WindowsIdentity;..SID...

From browser if I'm calling the same endpoint without collection: https://tfshost.com/tfs/_apis/Identities/System.Security.Principal.WindowsIdentity;..SID...

It is going to give me a globally unique id. But in the SDK there is no such wrapper and it seems like the extension do not have permission to call this global api endpoint.

I would like to get this id through the extension itself, because I'm using JWT Authentication and the generated token also contains this id.

So that I would be able to work with TFS Identities against the current user that is sent by JWT Auth in a 3rd party service.

K. Roland
  • 332
  • 2
  • 11

1 Answers1

1

We can use VSS.getWebContext().user.id to get the identify for the current user via vss-web-extension-sdk.

More detail about this API and SDK, you can refer the documents below:

UserContext

Core Client SDK

vss-web-extension-sdk repository on GitHub:

vss-web-extension-sdk

Fei Xue
  • 14,369
  • 1
  • 19
  • 27