首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用MS Graph访问其他租户用户日历时出错

使用MS Graph访问其他租户用户日历时出错
EN

Stack Overflow用户
提问于 2019-11-08 14:48:11
回答 2查看 566关注 0票数 1

我有一个node.js/express应用程序。我试图使用Microsoft来获取用户的日历只读。

用于登录的OAuth2库:护照-微软 npm模块。

在Azure门户中,我遵循了以下步骤:

  1. 转到Active Directory
  2. 单击左侧窗格中的App注册
  3. 单击“新注册”并创建一个应用程序
  4. 转到新应用程序
  5. 单击左侧面板中的身份验证并添加重定向URI的
  6. 转到API权限并启用以下操作: a.委托: Calendars.Read、Calendars.Read.Shared、profile
  7. 为所有需要该权限的权限提供管理员同意。

然而,只有属于我的天青组织的用户,我已经在其中注册了我的web应用程序,才能登录。

其他组织用户无法登录。我收到以下错误消息:

代码语言:javascript
复制
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)

您可以阅读我之前的问题,以供参考这里

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-11-12 06:43:34

将应用程序注册为多租户,并为您自己的租户做管理员同意是不够的。

你需要做的管理同意这个多租户Azure广告应用程序针对其他租户。

要通过URL请求授予管理员同意:

使用应用程序配置构造对login.microsoftonline.com的请求,并将其附加到&prompt=admin_consent上。

这个网址看起来像:https://login.microsoftonline.com/<tenant-id of other tenant>/oauth2/authorize?client_id=<client id>&response_type=code&redirect_uri=<redirect URI>&nonce=1234&resource=https://graph.microsoft.com&prompt=admin_consent

在使用其他租户的管理员凭据登录后,应用程序已被授予该租户中所有用户的同意。

票数 1
EN

Stack Overflow用户

发布于 2020-03-19 21:29:12

旧版本的管理许可对我不起作用。

现在,管理员同意的URL如下所示:

代码语言:javascript
复制
https://login.microsoftonline.com/{tenant-id}/adminconsent?client_id={client-id}

这对我来说很管用。新版本用批准租户对申请的行政许可描述。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58768782

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档