You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following exception:
Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: 'TF400813: The user ' is not authorized to access this resource. '
If I use the commented VssCredentials with PAT token with the same scope - I'm able to call both the Rest API and use this code.
The text was updated successfully, but these errors were encountered:
Following this guide: https://github.com/microsoft/azure-devops-auth-samples/blob/master/OAuthWebSample/README.md
I was able to create an application and authorize it to access ADO on behalf of me with the following scopes: vso.code_manage vso.project
When I generate a bearer token, I can see nameid claim value equal to my userId.
However, when I use the token - I get either 401 through Rest APIs (calling https://dev.azure.com/microsoft/_apis/projects), or using the following code:
string token = "<bearer_token>";
string patToken = "<pat_token>";
VssOAuthAccessTokenCredential credentials = new VssOAuthAccessTokenCredential(token);
//VssCredentials credentials = new VssBasicCredential(string.Empty, patToken);
// Connect to Azure DevOps Services
VssConnection connection = new VssConnection(new Uri(c_collectionUri), credentials);
Console.WriteLine(connection.AuthorizedIdentity.DisplayName);
I get the following exception:
Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: 'TF400813: The user ' is not authorized to access this resource. '
If I use the commented VssCredentials with PAT token with the same scope - I'm able to call both the Rest API and use this code.
The text was updated successfully, but these errors were encountered: