相关疑难解决方法(0)

尝试访问Azure Graph API时,权限不足错误

我已经设置了一个Azure AD应用程序,我想将其与我的Web应用程序一起使用.我使用以下步骤获得了oAuth令牌:

首先我请求了我的授权码:

https://login.windows.net/common/oauth2/authorize?redirect_uri={REDIRECT_URI}&client_id={CLIENT_ID}&response_type=code&state=o365&prompt=admin_consent
Run Code Online (Sandbox Code Playgroud)

这会将用户带到login.windows.net页面,他们必须接受我的应用程序将在其AD上使用的权限.

之后,我使用此端点https://login.windows.net/common/oauth2/token 使用C#获取oAuth Token :

{"code": {AUTH_CODE}},
{"state", {STATE}},
{"grant_type", "authorization_code"},
{"redirect_uri", "{REDIRECT_URI}"},
{"client_id", "1ff78c4b-414f-44c7-834b-09bdae96f440"},
{"client_secret", "{CLIENT_SECRET}"},
{"resource", "https://graph.windows.net"}
Run Code Online (Sandbox Code Playgroud)

一切都恢复正常,我得到我的oAuth令牌.但是,当我尝试使用令牌卷曲Graph API时,我收到此错误

curl https://graph.windows.net/{tenant}/users?api-version=1.5 -H "Authorization: Bearer [AUTH_TOKEN]"

{"odata.error":{"code":"Authorization_RequestDenied","message":{"lang":"en","value":"Insufficient privileges to complete the operation."}}}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了{tenant},"me"别名和"myorganization"别名的实际域名,但它们都不起作用."me"别名返回错误,指出'users'资源不存在.我对这里的问题感到困惑

c# oauth azure

11
推荐指数
1
解决办法
1万
查看次数

与O365的OAuth集成失败,错误AADSTS65005

我们有一个网站(建立在PHP框架上),我们为教师/学生提供在线教育工具.我们已经与google.com进行了OAuth集成,用户可以使用他们的Google帐户"注册"和"登录"我们的网站(可以是个人Gmail帐户,也可以是Google Apps域的成员).

我们正在尝试与O365进行类似的集成,我们的网站可以向O365询问用户的电子邮件和姓/名,以便我们可以在我们的网站上为他们创建帐户,并在创建帐户后将其登录.我们创建了Azure中的应用程序列表 - > Active Directory,并生成了客户端ID和机密,并将它们插入到PHP代码中.此处描述的OAuth工作流程一直有效,直到我尝试使用POST请求https://login.windows.net/common/oauth2/token请求访问令牌.它重定向回我的redirect_uri但不是给我auth代码,它在URL中给了我这些参数:

[error] => access_denied
[error_description] => AADSTS65005: The client application has requested access to resource 'https://outlook.office365.com/'. This request has failed because the client has not specified this resource in its requiredResourceAccess list.
Trace ID: xxxxxx
Correlation ID: xxxxxx
Timestamp: 2014-09-29 06:28:25Z
[state] => xxxxxx
Run Code Online (Sandbox Code Playgroud)

我需要的只是O365给我用户的电子邮件和f/l名称.当然有一个快速修复,我错过了?

php oauth azure office365 azure-active-directory

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

azure ×2

oauth ×2

azure-active-directory ×1

c# ×1

office365 ×1

php ×1