【发布时间】:2017-01-04 11:48:06
【问题描述】:
我们在 Azure AD 中有一个使用 Microsoft Graph API 的应用。该应用程序使用 4 个基本权限成功运行:电子邮件、个人资料 User.Read User.ReadBasic.All
这些权限让普通用户(非管理员)OAuth 验证进入我们的应用程序。
我们现在正在为管理员用户构建一项功能,让他们可以查看自己的群组。群组范围需要管理员同意:http://graph.microsoft.io/en-us/docs/authorization/permission_scopes
关键点是,如果我在 Azure AD 中的委派权限下添加 Group.Read.All 权限,这会导致普通用户能够登录并出现可怕的错误“AADSTS90093:由于缺少权限,调用主体无法同意”。
我尝试手动制作明确请求范围的 OAuth 授权 URL,但这也不起作用。这是我使用的示例网址:
https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&redirect_uri=https%3A%2F%2Fl.xxxxxx.com%3A50000%2Fauth%2Fmicrosoft_graph%2Fcallback&client_id=xxxxxx-xxx-xxx-xxx-xxxx&scope=https%3A%2F%2Fgraph.microsoft.com%2Femail%20https%3A%2F%2Fgraph.microsoft.com%2Fprofile%20https%3A%2F%2Fgraph.microsoft.com%2FUser.Read%20https%3A%2F%2Fgraph.microsoft.com%2FUser.ReadBasic.All%20https%3A%2F%2Fgraph.microsoft.com%2FGroup.Read.All
如何要求所有用户拥有基本权限,但管理员稍后会在应用程序中请求额外权限?
我已经查看了一些资源但无济于事:
http://www.mikepackdev.com/blog_posts/2-Dynamically-Requesting-Facebook-Permissions-with-OmniAuth
Switching between web and touch interfaces on Facebook login using Omniauth and Rails 3
https://github.com/zquestz/omniauth-google-oauth2/issues/143
https://azure.microsoft.com/en-us/documentation/articles/active-directory-protocols-oauth-code/
【问题讨论】:
标签: api azure oauth-2.0 office365 microsoft-graph-api