【问题标题】:Grant access microsoft graph doesn't work授予访问权限 microsoft graph 不起作用
【发布时间】:2016-08-24 15:59:04
【问题描述】:

我通过此链接为我的应用授予外部帐户访问权限 http://account.activedirectory.windowsazure.com/Consent.aspx?ClientID=2a97adb7-8e24-4b30-9999-f7989af33a31&RequestedPermissions=DirectoryReaders

预期: 接收租户 ID,我的应用程序出现在该外部帐户 http://account.activedirectory.windowsazure.com/ 那里

其实: 我收到了租户 ID,但我的应用没有出现在那个外部帐户中,所以我无法授权

代码

def get_oauth_url(self, request):
    authority = 'https://login.microsoftonline.com'
    authorize_url = '{0}{1}'.format(authority, '/common/oauth2/authorize?{0}')
    params = {'client_id': (settings.OFFICE365_CLIENT_ID),
              'redirect_uri': request.build_absolute_uri(reverse('office365_oauth_return')),
              'response_type': 'code',
              'state': state,
              'resource': 'https://graph.microsoft.com',
              'grant_type': 'client_credentials',
              }

    return authorize_url.format(urlencode(params))

错误:

问题 u'AADSTS70002:验证凭据时出错。 AADSTS50012:身份验证失败 跟踪 ID:516d8605-4dc8-4dbe-9381-b22c49b2d9ee 相关 ID:c8439084-4e3e-4301-8b10-141119be0c9a 时间戳:2016-08-24 15:57:19Z'

【问题讨论】:

  • 我强烈建议:1. 清楚地描述您遇到的问题(您期望什么,实际发生了什么) 2. 提供一个您需要帮助的代码示例 3. 正确格式化问题。以目前的形式,它很可能没有得到答复。

标签: python microsoft-graph-api


【解决方案1】:

Alexey - 不确定您在哪里获得了上面的同意链接/URL。这是一个旧 URL,只能提供对 Azure AD Graph API 的同意。了解是什么导致您使用该 URL 会很有趣。我建议您查看此处列出的 Microsoft Graph 示例https://graph.microsoft.io/en-us/code-samples-and-sdks。我们有一个 Python 示例 - https://github.com/microsoftgraph/python3-connect-rest-sample

有关授权/同意和获取 Microsoft Graph 令牌的背景,请参阅以下主题 https://graph.microsoft.io/en-us/docs/authorization/auth_overview

希望对你有帮助,

【讨论】:

    猜你喜欢
    • 2015-05-24
    • 1970-01-01
    • 2018-12-20
    • 2021-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-27
    • 1970-01-01
    相关资源
    最近更新 更多