Microsoft Graph范围v2 oauth

Lie*_*cin 7 microsoft-graph

我正在尝试构建一个简单的Ruby应用程序,它可以连接到Microsoft Graph API并获取有关用户的基本信息,例如经理或直接下属.

我已经按照0365教程,我有一个能够获得用户邮件的工作应用程序.但是,当我尝试使用会话令牌查询图api时,我收到一个错误:

response.body
=> "{\r\n  \"error\": {\r\n    \"code\": \"InvalidAuthenticationToken\",\r\n    \"message\": \"Access token validation failure.\",\r\n    \"innerError\": {\r\n      \"request-id\": \"18cbc6be-5254-400c-9780-7427376587fb\",\r\n      \"date\": \"2016-06-30T22:21:55\"\r\n    }\r\n  }\r\n}" 
Run Code Online (Sandbox Code Playgroud)

我正在使用示波器

SCOPES = [ 'openid', 'profile', 'https://outlook.office.com/contacts.read', 'offline_access' ] 
Run Code Online (Sandbox Code Playgroud)

我刚刚被建议包括范围' https://graph.microsoft.com/user.read ',但是当我将其添加到应用程序时,我甚至在点击用户登录页面之前得到以下错误:

AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope openid profile offline_access https://graph.microsoft.com/user.read is not valid.
Run Code Online (Sandbox Code Playgroud)

任何有关这方面的帮助将不胜感激!

Jas*_*ton 11

好.问题是您要包括Outlook(https://outlook.office.com/contacts.read范围)和Graph(https://graph.microsoft.com/user.read范围)的范围.不幸的是,Azure的授权端点不支持这样的混合范围.您可以删除Outlook范围(假设您不需要它),或将其更改为等效的Graph :( https://graph.microsoft.com/contacts.read如果您需要访问登录用户的个人联系人).