Vic*_*pan 3 odata oauth-2.0 postman azure-devops azure-devops-rest-api
在邮递员中,我设置了简单的请求来访问 Azure DevOps API,通过 Azure AD 使用 OAuth 2.0 安全 https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view= azure-devops-rest-5.1 在 Azure AD 应用程序设置上,有权在用户同意的情况下访问 Azure DevOps API
我正在获取令牌,但是 Azure DevOps API 不断返回代码 203,并使用登录 html 而不是 json 响应。如果有任何建议,我将不胜感激
谢谢
邮递员请求
GET /[some_org]/_apis/projects?api=5.1 HTTP/1.1
Host: dev.azure.com
Authorization: Bearer [something]
User-Agent: PostmanRuntime/7.17.1
Accept: */*
Cache-Control: no-cache
Postman-Token: [something]
Accept-Encoding: gzip, deflate
Cookie: VstsSession=[something]
Referer: https://dev.azure.com/[some_org]/_apis/projects?api=5.1
Connection: keep-alive cache-control: no-cache
Run Code Online (Sandbox Code Playgroud)
小智 7
https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1
对于 Azure DevOps Services,实例是 dev.azure.com/{organization},因此模式如下所示:
VERB https://dev.azure.com/{organization}/_apis[/{area}]/{resource}?api-version={version}
Run Code Online (Sandbox Code Playgroud)
如果您希望通过 HTTP 标头提供个人访问令牌,则必须首先将其转换为 Base64 字符串(以下示例演示如何使用 C# 转换为 Base64)。(某些工具(例如 Postman)默认应用 Base64 编码。如果您通过此类工具尝试 API,则不需要 PAT 的 Base64 编码)。
Authorization: Basic BASE64PATSTRING
Run Code Online (Sandbox Code Playgroud)
我将邮递员配置为使用 GET 请求和基本身份验证(并且它有效)
获取http://dev.azure.com/ {organization-id}/_apis/projects?api-version=5.1
有关 Azure DevOps REST API 的个人访问令牌的更多信息,请参阅
此处
PS 这里是有关 Azure DevOps REST API 和 OAuth 2.0 身份验证的页面 这里 有有关如何注册应用程序以生成授权所需的 OAuth 2.0 凭据的信息。
| 归档时间: |
|
| 查看次数: |
8854 次 |
| 最近记录: |