我想在 angular 7+ http 调用中从 Microsoft 图中调用 Token API

问题描述

从 angular 应用程序中,我想调用 https://login.microsoftonline.com/##tenant##/oauth2/v2.0/token api 以从 http 调用获取访问令牌,并使用该令牌调用 https://graph.microsoft.com/v1.0/users/##UserId##​​​​​​​​​​​​​/getMemberGroups API,而不使用任何 angular 的 npm 包。

我尝试使用 http 服务,但出现以下错误

从源“https://xxx.co”访问“https://login.microsoftonline.com/xxxx/oauth2/v2.0/token”的 XMLHttpRequest 已被 CORS 策略阻止:没有“访问-请求的资源上存在 Control-Allow-Origin' 标头。

有没有其他方法可以调用 Graph API 获取令牌和用户获取登录用户组?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)