python - 将 django-microsoft-auth 用于 Azure AD 的 SSO 时出现 AADSTS90102 错误
问题描述
我按照本教程中的步骤为我的 Django 应用程序的管理部分(启动)启用了 Azure Active Directory 的 SSO: https ://django-microsoft-auth.readthedocs.io/en/latest/usage.html
重要的错误似乎是:AADSTS90102:“redirect_uri”值必须是有效的绝对 URI。
在这个窗口中,我使用浏览器控制台,发现正在发出一个 GET 请求,如下所示:
https://login.microsoftonline.com/50ce...90ac7/oauth2/v2.0/authorize?response_type=code&client_id=f4...27&redirect_uri=https,https://example.org/microsoft/auth-callback/&s...
注意redirect_uri=https,https://...
. 似乎领先的“https”是多余的并且导致了问题。任何想法可能来自哪里?
在我的 Azure 应用程序中,重定向 URI 设置为https://example.org/microsoft/auth-callback/
:
我正在使用 Python 3.9.6、Django 3.2、django-microsoft-auth 2.4.0、NGINX 1.18.0、uvicorn 0.14.0
我已经为此寻求帮助,但没有找到与我的情况相关的任何内容。提前致谢!
解决方案
基于 SO 线程参考。
在大多数情况下,使用 http 作为重定向 URI 而不是 https 来解决问题。
利用
http://localhost:8080/microsoft/auth-callback/
代替
https://localhost:8080/microsoft/auth-callback/
如果有选项,
使用 localhost:8080 进入表 django_site
推荐阅读
- c# - 统一的 C# 的 CS1519
- huawei-mobile-services - 在HMS中,如何为已经发布的新版本应用程序更改应用程序签名?
- rundeck - 节点不显示,控制台显示 xml 解析错误
- sql - 根据从搜索中找到的 IDS 数量插入动态行数
- docker - Kubernetes 以 root 身份创建容器日志
- sql-server - Terraform - Azure - 一起使用“azurerm_windows_virtual_machine”和“azurerm_mssql_virtual_machine” - 但未配置 SQL 存储
- azure - Azure Batch VM 中 CUDA 初始化的执行时间很慢
- excel - 应用条件格式后如何删除它?
- python - 使用 ctypes 将 2D C 数组转换为 Numpy 数组
- swift - 基于更改子视图高度以编程方式增加 UIView 高度