如何为Azure AD身份验证v2.0

时间:2016-05-22 18:19:44

标签: azure azure-active-directory adal azure-api-management azure-ad-graph-api

我已经设置了一个新的Web应用程序,以便能够使用Oauth2 V2授权终结点。我在https://apps.dev.microsoft.com/

中定义了该应用

如果我想按照

中的说明获取新的授权令牌

https://blogs.msdn.microsoft.com/richard_dizeregas_blog/2015/09/04/working-with-the-converged-azure-ad-v2-app-model/

我在登录页面上收到以下错误:

抱歉,我们在登录时遇到问题。 我们收到了一个错误的请求。

其他技术信息: 相关ID:eb9c2331-32bd-45a9-90d1-e9105f0bfa87 时间戳:2016-05-22 18:10:48Z AADSTS70011:输入参数“scope”的提供值无效。范围https://graph.microsoft.com/Calendar.Read无效。

范围取自以下示例: https://github.com/Azure/azure-content/blob/master/articles/active-directory/active-directory-v2-scopes.md

所以我认为这是一个有效的范围。

在OAuth2协议的v1中,在使用它们之前,必须在我的租户的Azure AD中配置对API的访问。所以我试图为新的应用程序这样做。

尝试执行此操作时,Azure应用程序管理会报告错误:

{   “message”:“此请求的值无效。”,    “ErrorMessage”:“此请求的值无效。”,    “httpStatusCode”: “InternalServerError”, “operationTrackingId”:空, “堆栈跟踪”:空, “填充”:零 }

能够使用新授权端点缺少什么?

1 个答案:

答案 0 :(得分:1)

如果状态为calendar.read,则文档中包含拼写错误。它必须是calendars.read:

private static string [] scopes = {         " https://graph.microsoft.com/calendars.readwrite"};

Uri authUri = await authContext.GetAuthorizationRequestUrlAsync(scopes,additionalScopes,clientId,redirectUri,UserIdentifier.AnyUser,null);