首页 > 解决方案 > Azure DevOps OAuth enpoint 始终返回 error=InvalidScope

问题描述

我坚持使用 Oauth 2.0 将我的 C# MVC 应用程序授权给 Azure DevOps Services API。我遵循了本教程:https ://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops

当我请求以下授权 URL 时,我将收到错误“InvalidScope”。所以,我一定做错了什么。

https://app.vssps.visualstudio.com:443/oauth2/authorize?client_id= {id}&response_type=Assertion&state=statestring&scope=vso.code_status&redirect_uri=https%3a%2f%2flocalhost%3a44380%2foauth%2fcallback

我的回调 URL 已成功请求,但始终显示错误“InvalidScope”消息。所以,我不明白我做错了什么。

如果有人可以进一步帮助我,将不胜感激!

标签: c#azureoauth-2.0azure-devops

解决方案


答案是需要在授权 URL 中指定所有可用范围,因此我指定的所有 Azure DevOps 范围似乎都是必需范围。


推荐阅读