Skip to content

bug: 出现 AADSTS90023 错误。 #94

Description

@XiaoSeee
# Bug Report / Bug 报告

**Version / 版本:**

Official Docker image: `ghcr.io/zeropointsix/outlook-email-plus:latest`

**Current behavior / 当前行为:**

OAuth Token 工具中使用 “Graph 邮件” 预设生成授权链接时,scope 为:

```text
offline_access https://graph.microsoft.com/.default

在个人 Microsoft 账号 tenant=consumers 场景下,即使 Azure App Registration 已配置 Microsoft Graph 委托权限 Mail.ReadUser.Readoffline_access,并强制 Consent,授权码换取 Token 时仍会报错:

invalid_request: AADSTS90023: No applicable permissions were found for this user.

Expected behavior / 期望行为:

Graph 邮件预设应能在个人 Microsoft 账号场景下正常完成授权并换取 refresh token。

建议 Graph 预设使用具名委托权限:

offline_access https://graph.microsoft.com/Mail.Read https://graph.microsoft.com/User.Read

Steps to reproduce / 复现步骤:

  1. 使用官方 Docker 镜像部署项目。
  2. Azure App Registration 配置:
    • Supported account types: organizational directory + personal Microsoft accounts
    • Redirect URI: http://localhost
    • Public client flow enabled
    • Microsoft Graph delegated permissions: Mail.Read, User.Read, offline_access
  3. 打开 OAuth Token 工具,选择 “Graph 邮件” 预设。
  4. 勾选强制 Consent,生成授权链接。
  5. 使用个人 Microsoft 账号授权,复制回调 URL。
  6. 粘贴回调 URL 换取 Token。
  7. 出现 AADSTS90023 错误。

Related code / 相关代码:

// static/js/features/token_tool.js
const SCOPE_PRESETS = {
    graph: ['offline_access', 'https://graph.microsoft.com/.default'],
    imap: ['offline_access', 'https://outlook.office.com/IMAP.AccessAsUser.All'],
};
# outlook_web/services/graph.py
DEFAULT_GRAPH_SCOPE = "https://graph.microsoft.com/.default"

Other information / 其他信息:

临时验证后,将 Graph scope 改为具名权限可解决该问题:

offline_access https://graph.microsoft.com/Mail.Read https://graph.microsoft.com/User.Read

建议:

  1. 将前端 Graph 邮件预设从 .default 改为具名 delegated scopes。
  2. 将 Graph refresh token 默认 scope 同步改为具名 delegated scopes。
  3. 对历史保存的 offline_access https://graph.microsoft.com/.default 做兼容迁移。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions