python - Flask Make Azure Blueprint - 得到一个意外的参数“租户”
问题描述
我正在尝试使用 Azure Active Directory 来允许我公司的 Microsoft 域中的用户登录到我的 Flask webapp。我收到一条错误消息:
消息:AADSTS90130:应用程序 ... 不受 /common 或 /consumers 端点的支持。请使用 /organizations 或特定于租户的端点。
所以我做了一些研究,发现这个文档说我可以设置一个“租户”参数,但是当我运行这个时:
blueprint = make_azure_blueprint(
client_id="client_id_here",
client_secret="client_secret_here",
tenant="tenant_here"
)
我收到一个错误:
TypeError:make_azure_blueprint() 得到了一个意外的关键字参数“租户”
有谁知道我做错了什么?如何在 Flask Dance 中设置 Azure 租户?
解决方案
如果其他人遇到这个问题:我发现默认情况下库实际上并不包含租户参数。您可以通过简单地进入烧瓶舞蹈库中的 azure.py 文件并将两行更改为读取来添加它:
authorization_url="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize".format(tenant=tenant),
token_url="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token".format(tenant=tenant),
推荐阅读
- laravel - 如何获取与 Laravel 的 3 个模型多对多关系的数据?
- php - 干预图像。获取 md5 哈希
- javascript - .toLowerCase() / .toUpperCase() 不工作
- swift - 使用 JSON 对象中的键解析数据并显示为列表
- python - pycharm或其他产品有没有类似gitlens的插件?
- android - 在 POST 请求中发送图像时在服务器中获取空请求正文
- python - Python,计算元素数量的数组差异
- php - PDO 驱动程序在 Windows PC 中没有价值
- python - 如何从 ML 结果中解析这个数组?
- python - 使用 Jinja 和 Flask 在新的 HTML 页面上打印渲染数据