【问题标题】:Is it possible to get an access token from Azure DevOps using client credential flow?是否可以使用客户端凭据流从 Azure DevOps 获取访问令牌?
【发布时间】:2020-03-17 14:53:18
【问题描述】:

从这里的文档https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops 看来,应用程序似乎可以使用 OAuth2 授权代码流来获取访问令牌。但是,如果我尝试使用客户端凭据流获取访问令牌,则会收到 invalid_resource 错误。令牌端点似乎支持客户端凭据流,但我无法让它工作。

POST https://app.vssps.visualstudio.com/oauth2/token
Content-Type application/x-www-form-urlencoded

grant_type=client_credentials&redirect_uri=$url&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion=$assertion&client_id=$clientid&client_secret=$secret&scope=vso.code

什么是正确的资源价值?

【问题讨论】:

    标签: azure-devops azure-devops-rest-api


    【解决方案1】:

    不知道下面的微软文档是不是你要找的,它描述了如何使用客户端凭据流。希望对您有所帮助!

    https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow

    【讨论】:

    • 嗨@Levi,感谢您的回复。实际上,文档已经描述了 OAuth2 授权代码授予流程。我想知道是否可以使用 OAuth2 客户端凭据流。我可以毫无问题地让授权代码流正常工作。
    • 嗨@SureshAtt 你有机会查看上面的链接吗?请告诉我进展如何?
    • 这种方法不起作用。因为上面的链接是针对天蓝色广告的,而我需要从这里获取令牌 app.vssps.visualstudio.com/oauth2/token 这不是天蓝色广告。
    • @Levi - 你最终得到这个工作了吗?看起来我和你走上了同样令人困惑的道路,我可以获得任何体面的一致信息。这是我的问题:stackoverflow.com/questions/60875738/…
    猜你喜欢
    • 1970-01-01
    • 2015-04-16
    • 2019-04-04
    • 2020-07-07
    • 1970-01-01
    • 2021-10-23
    • 2019-01-03
    • 1970-01-01
    • 2021-09-01
    相关资源
    最近更新 更多