如何使用Azure活动目录验证Python烧瓶API

问题描述 投票:-1回答:1

我创建了python flask api,我需要使用azure活动目录进行身份验证。我有client secretclient idtenant。我正在关注微软的example。但它会引发错误:

Sign in
Sorry, but we’re having trouble signing you in.

AADSTS65005: Misconfigured application. This could be due to one of the 
following: The client has not listed any permissions for 'Microsoft Graph' in 
the requested permissions in the client's application registration. Or, The 
admin has not consented in the tenant. Or, Check the application identifier in 
the request to ensure it matches the configured client application identifier. 
Please contact your admin to fix the configuration or consent on behalf of the 
tenant. Client app ID: 561b7942-251c-4f36-8f80-4409947bf61f

任何人都可以建议我使用azure活动目录验证基于python烧瓶的应用程序的良好工作示例/教程。

谢谢

python azure
1个回答
1
投票

错误代码指向缺少权限。

您关注的示例看起来不错。如果您正确执行此步骤,请检查

  1. 配置应用程序的权限。在“设置”菜单中,选择“所需权限”部分,然后单击“添加”,再单击“选择API”,然后在文本框中键入Microsoft Graph。然后,单击“选择权限”并在“委派权限”下选择“登录”并阅读用户配置文件。

我正在提供截图以使其更明确。请一直关注到最后。特别是击中“授予权限”的最后一步。我已经看到它多次错过并导致像你这样的错误,因为缺少同意。

  1. 转到编辑应用设置

enter image description here

  1. 选择所需权限

enter image description here

  1. 添加Microsoft Graph

enter image description here

  1. 请确保在“委派权限”部分enter image description here下选择此权限
  2. 完成“选择”和“完成”以选择所选权限后,这就是我猜您在首次设置时错过的步骤。点击“授予权限”enter image description here
© www.soinside.com 2019 - 2024. All rights reserved.