问题描述
在我们的应用中,我们想要检索一个访问令牌.使用此令牌,我们希望使用Azure DevOps rest API 5.1执行某些操作.
我已经尝试过从Microsoft针对OAuth2进行建议的文档化(
-
配置应用程序
a.创建客户机密
b.配置权限
-
获取令牌
#获取代码GET https://login.microsoftonline.com/{tenant}/oauth2/authorize?client_id =<您的应用程序客户端ID>& response_type =代码& redirect_uri =<>& response_mode =查询& resource = 499b84ac-1321-427f-aa17-267ca6975798& state = 12345#获取令牌发布https://login.microsoftonline.com/{tenant}/oauth2/token内容类型:application/x-www-form-urlencodedgrant_type =授权码& client_id =<>& code =<>& redirect_uri = https%3A%2F%2Flocalhost%3A12345& resource = 499b84ac-1321-427f-aa17-267ca6975798& client_secret =<>
- 通话休息API
In our app we want to retrieve an accesstoken. With this token we want to perform certain actions with Azure DevOps rest API 5.1.
I've tried the suggested documententation from Microsoft for OAuth2 (https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops) and PAT's. This always gives back a 203 response as an result. Does somebody know a workaround for this issue?
According to my test, we can call Azure DevOps rest API with Azure Ad access token. For more details, please refer to the following steps1. Register an Azure AD application
Configure applications
a. Create client secret
b. Configure permissions
Get token
# get code
GET https://login.microsoftonline.com/{tenant}/oauth2/authorize?
client_id=<your app client id>
&response_type=code
&redirect_uri=<>
&response_mode=query
&resource=499b84ac-1321-427f-aa17-267ca6975798
&state=12345
#Get token
Post https://login.microsoftonline.com/{tenant}/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&client_id=<>
&code=<>
&redirect_uri=https%3A%2F%2Flocalhost%3A12345
&resource=499b84ac-1321-427f-aa17-267ca6975798
&client_secret=<>
- Call Rest API
这篇关于检索Azure DevOps REST API 5.1的Accesstoken的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!