【发布时间】:2019-11-08 14:48:11
【问题描述】:
我有一个 node.js/express 应用程序。 我正在尝试使用 Microsoft Graph API 来获取用户的日历 [只读]。
用于登录的 OAuth2 库:passport-microsoft npm 模块。
我在 Azure 门户中按照以下步骤操作:
转到活动目录
点击左侧窗格中的应用注册
- 点击新注册并创建一个应用程序
- 转到新应用
- 单击左侧面板中的身份验证并添加重定向 URI
-
转到 API 权限并启用以下内容:
一个。委托:Calendars.Read、Calendars.Read.Shared、profile
- 为所有需要的权限提供管理员同意。
但是,只有属于我的 azure 组织(我已在其下注册了我的 Web 应用程序)的用户才能登录。
其他组织用户无法登录。我收到以下错误消息:
2019-11-11 10:16:35 default[20191109t101750] InternalOAuthError: failed to fetch user profile
2019-11-11 10:16:35 default[20191109t101750] at /srv/node_modules/passport-microsoft/lib/strategy.js:86:29
2019-11-11 10:16:35 default[20191109t101750] at passBackControl (/srv/node_modules/oauth/lib/oauth2.js:132:9)
2019-11-11 10:16:35 default[20191109t101750] at IncomingMessage.<anonymous> (/srv/node_modules/oauth/lib/oauth2.js:157:7)
2019-11-11 10:16:35 default[20191109t101750] at IncomingMessage.emit (events.js:203:15)
2019-11-11 10:16:35 default[20191109t101750] at IncomingMessage.EventEmitter.emit (domain.js:466:23)
2019-11-11 10:16:35 default[20191109t101750] at endReadableNT (_stream_readable.js:1145:12)
2019-11-11 10:16:35 default[20191109t101750] at process._tickCallback (internal/process/next_tick.js:63:19)
您可以阅读我之前的问题以供参考here
【问题讨论】:
-
您的应用需要允许其他组织通过使其成为多租户登录。
-
我已经使它成为多租户,但是仍然没有成功
-
请添加有关您收到的错误消息的更多详细信息。
-
我已经添加了我正在遵循的步骤,以及我收到的错误消息。如果我能提供更多信息,请告诉我
-
还有。该应用程序从一开始就注册为多租户
标签: node.js azure-active-directory microsoft-graph-api passport.js microsoft-graph-calendar