BeginnerCoder
BeginnerCoder

Reputation: 403

VSO REST API - Getting user profile image only works with basic authentication?

I'm using the VSO REST API to get all members in a team, from there I'm getting the ImageUrl of the member.

If I just bind an Image control to ImageUrl it's blank because VSO requires that I be signed in to get a profile picture... so I created a HttpClient and set my Authorization to OAuth and gave it my access token.

This just returns a 403 : Forbidden response... But if I use basic authentication, then everything works fine?

Is basic authentication the only method to get profile images from VSO via the REST API?

Upvotes: 16

Views: 2293

Answers (1)

Richard Banks
Richard Banks

Reputation: 12546

Both Basic Auth and OAuth 2.0 are supported by the REST API.

Click through to details on using OAuth 2.0 with the API

UPDATE: Missed an important part of the question. Sorry. :-(

To get a user's image the endpoint is

https://*.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=<Guid>

Unfortunately _api/_common/identityImage is not an allowed route for an app that authenticates with an OAuth access token at the moment, so this is an expected behavior. The team is aware of it, though I don't know where it is in their list of priorities.

Add a suggestion at http://visualstudio.uservoice.com for this so that it makes the request more visible for them.

Upvotes: 8

Related Questions