我通过外部帐户的此链接授予对我的应用程序的访问权限 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'
亚历克赛-不知道你从哪里得到了上面的同意链接/网址。这是一个旧的遗留URL,只能提供对Azure AD Graph API的许可。这将是有趣的,了解是什么导致你使用该网址。我建议您看看这里列出的Microsoft Graph示例https://graph.microsoft.io/en-us/code-samples-and-sdks。我们有一个Python的示例-https://github.com/microsoftgraph/python3-connect-rest-sample
此外,有关授权/同意和获取MicrosoftGraph令牌的背景信息,请参阅以下主题https://graph.microsoft.io/en-us/docs/authorization/auth_overview。你知道吗
希望这有帮助
相关问题 更多 >
编程相关推荐