azure - 即使在多租户应用获得管理员同意后,Azure AD 用户登录应用也会失败
问题描述
我在 azure 门户应用程序注册中注册了一个示例多租户应用程序,需要某些权限才能访问 Outlook 邮件。我还有一个 SAAS 应用程序,它使用此应用程序并请求用户提供 oauth 令牌以使用 Outlook 阅读和发送电子邮件。
有一组用户想要使用我的应用程序在 SAAS 应用程序中配置电子邮件的租户。但是租户中的用户没有管理员权限来同意该应用程序。根据MS 文档,管理员必须使用 v2-permissions-and-consent 同意应用程序
管理员已使用以下 URL 同意该应用程序:
https://login.microsoftonline.com/ {租户 ID}/v2.0/adminconsent?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxb&state=12345&redirect_uri=https://c9713e1c5859.ngrok.io/auth/outlook/callback&scope=https://outlook.office .com/User.Read https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send&response_type=code
管理员同意的权限: 同意的权限
即使在管理员同意应用程序请求的所有权限并将用户添加到 Azure AD 中配置的企业应用程序后,用户在尝试登录应用程序时也会看到批准提示。
向用户显示批准提示: 批准提示
理想情况下,一旦应用程序在 Azure AD 企业应用程序中获得批准,租户中的所有其他用户都应该能够在没有任何同意要求的情况下使用该应用程序。
用户用于登录的 oauth URL 是
谁能帮我理解我在这里缺少什么?
解决方案
应征得目标租户管理员同意,然后使用目标租户登录。
在下面的 url 中,你应该用错了 {tenant ID}
,它应该是目标租户 ID。不是您的应用所在的租户 ID。
https://login.microsoftonline.com/{tenant ID}/v2.0/adminconsent?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxb&state=12345&redirect_uri=https://c9713e1c5859.ngrok.io/auth/outlook/callback&scope=https://outlook.office.com/User.Read https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send&response_type=code
我已经测试过了,然后重现了你的问题。如果您需要进一步的帮助,请告诉我。
推荐阅读
- firebase - Firestore 仅保留最新文档的经济有效方式?
- python - 确保 pandas read_csv 遵守给定的 dtypes
- json - 使用 php 中的 curl 以 jsonobject 格式推送 post 方法数据
- node.js - 如何在nodejs服务器环回中编写连接查询?
- python - Python - 单元测试来比较两个函数的输出
- sql - SQL 更新语句 - 比较可为空字段的值
- java - Java / Android 中的 EA Async.Init() 错误
- java - IndexOn 计算我的数据库中的总用户数
- nginx - NGINX 从外部服务器重新加载 CRL 文件
- coq - 如何证明交换其参数的关系的可判定性?