Home > database >  Q: Azure DevOps API Authentication
Q: Azure DevOps API Authentication

Time:02-11

I would like to use the Azure DevOps API to create a PAT for my user. But I'm unable to authenticate yet. In this document from Microsoft, they state that authentication is possible with a PAT, but it is not true. I'm getting a HTTP 203 with a Sign In page in response.

PS: I'm using Postman to test the API requests.

CodePudding user response:

I think the security section of this REST API is misleading.

In fact, this REST API cannot be authenticated with PAT, as mentioned in another document:

To use the API, you must authenticate with an Azure AD token.

Unlike other Azure DevOps Services APIs, users must provide an Azure AD access token to use this API instead of a PAT token. Azure AD tokens are a safer authentication mechanism than using PATs. Given this API’s ability to create and revoke PATs, we want to ensure that such powerful functionality is given to allowed users only.

This document also explains how to use this REST API in detail, which you can refer to.

CodePudding user response:

Yes it does work, you're just not setting it up right.

Look at the Basic Authentication of this document. You need to base 64 encode the username password like this: username:PAT. Spearate the two with the colon.

  • Related