azure-active-directory – Microsoft Azure AD图API:如何检索
我能够访问用户的accessToken,并且正在使用Authorization:Bearer< token>来调用GET https://graph.microsoft.com/v1.0/me.头.
但是,在响应正文中,我得到的是这样的: { "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users","value": [ { "givenName": "Foo","surname": "Bar","displayName": "Foo Bar","id": "b41efha115adcca29","userPrincipalName": "email.address@outlook.com","businessPhones": [],"jobTitle": null,"mail": null,"mobilePhone": null,"officeLocation": null,"preferredLanguage": null } ] } mail属性为null,此响应正文中的userPrincipalName恰好是用户的电子邮件地址.但是,这是来自微软的docs:
在启动用户的登录请求时,我们正在请求“user.read”和“email”范围.我们使用MSAL.js库来获取访问令牌,我们的代码读取如下内容: login (): ng.IPromise<IMicrosoftOAuthResponse> { const prom = this.userAgentApplication.loginPopup(["user.read","email"]) .then((idToken) => { return this.userAgentApplication.acquireTokenSilent(["user.read","email"]); }) .then((accessToken) => { // at this point,we have the accessToken and make a call to the graph api }); return this.$q.when(prom); } 如何在此处获取用户的实际电子邮件地址?
mail属性设置为以下两种方式之一:
>它已在内部部署AD上设置,然后使用AD Connect同步到Azure AD 如果用户没有O365邮箱/许可证,您还可以通过userPrincipalName,displayName等搜索用户.$filter支持OR运算符. 希望这可以帮助, (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Windows安装MySQL
- 预编译的Windows OMF BLAS / LAPACK?
- WiX Bundle升级:在删除旧版本之前安装新版本的MSI
- 1 windows MySql 5.6 安装
- windows-phone-7 – 如何将SqlCe数据库部署到用于Windows P
- windows-8 – 如何在Windows 8.1(IE11和Modern UI)上调试PA
- windows – 无法在Active Directory中移动OU(拒绝访问)
- 仅包含“欢迎”和“已完成”屏幕的WiX脚本
- 如何在Windows 10 Enterprise上运行应用程序作为shell替换
- windows-vista – 我的Vista的nslookup返回ipv6站点的ipv4地
- windows-server-2008-r2 – 安装Server 2008 R2
- windows-8 – 如何通过VirtualBox运行Windows 8
- windows-phone-8 – Windows Phone 8:支持原生U
- windows-authentication – 通过RADIUS进行身份验
- 如何控制Windows中打印机的打印机托盘选择
- 如何从Windows锁定Windows(如“Windows L”)?
- Windows – IIS日志文件和负载均衡器?
- Windows – 如何使用Delphi从文件扩展名获取图标
- windows-server-2012 – 如何更改当前用户密码?
- Windows Azure发布网站 – “无法获取订阅信息.已