microsoft-graph – 使用MSAL的Microsoft Graph API Organizatio
发布时间:2020-12-14 05:34:39 所属栏目:Windows 来源:网络整理
导读:在AAD应用程序注册中,Implicit Grant Flow为true; 我们已将权限委派给User.Read和User.Read.All. private static getContext(): Msal.UserAgentApplication { if (AuthenticationService.Context) return AuthenticationService.Context; const logger = new
在AAD应用程序注册中,Implicit Grant Flow为true;
我们已将权限委派给User.Read和User.Read.All. private static getContext(): Msal.UserAgentApplication { if (AuthenticationService.Context) return AuthenticationService.Context; const logger = new Msal.Logger((_logLevel,message,_piiEnabled) => { console.log(message); },{ level: Msal.LogLevel.Verbose,correlationId: "12345" }); AuthenticationService.Context = new Msal.UserAgentApplication( Environment().authentication.clientId,AuthenticationService.getAuthority(),(errorDesc,token,error,_tokenType) => { if (token) { AuthenticationService.isAuthenticated = true; AuthenticationService.accessToken = token; } else { const localizedError: string = LocalizationService.localize(error); alert(localizedError !== error ? localizedError : errorDesc); } },{ logger: logger,storeAuthStateInCookie: true,state: "12345",cacheLocation: "localStorage" // enable this for IE,as sessionStorage does not work for localhost. }); if (AuthenticationService.Context.getUser()) { AuthenticationService.isAuthenticated = true; } return AuthenticationService.Context; } 我们有登录方法: public static login(): void { const context: Msal.UserAgentApplication = AuthenticationService.getContext(); if (context.loginInProgress()) return; AuthenticationService.CurrentUser = null; context.loginRedirect(AuthenticationService.SCOPES); } 我们有获取图表令牌的方法: public static async getGraphToken(): Promise<string | null> { const authContext: Msal.UserAgentApplication = AuthenticationService.getContext(); const cachedUser: Msal.User = authContext.getUser(); if (!cachedUser) { return null; } return authContext.acquireTokenSilent(AuthenticationService.SCOPES); } 当我使用图形令牌获取用户照片时,我有: { "error": { "code": "OrganizationFromTenantGuidNotFound","message": "The tenant for tenant guid '68cc0dcb-5873-4ea0-a498-fe57e9b51827' does not exist.","innerError": { "request-id": "b402e405-342a-4002-a880-84f30413cbf7","date": "2018-11-30T23:39:23" } } } 解决方法
我遇到了同样的问题,经过4个小时的试错,我解决了这个问题.
我的情况有点不同,但它可能适用于您的情况. 我试图读取失败并出现相同错误的用户电子邮件(/ users / userId / messages).试图获取用户的信息确实有效,但试图让消息失败,这让我意识到即使用户确实存在于我的AD上,交换帐户的实际AD也不同……一旦我移动了我的应用注册正确的AD一切都很完美…… 希望有帮助…… (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- .net – 两个DLL中都存在该类型
- 在Windows机器上,远程维护的典型工具链是什么?
- windows 下查函数表 VS2010中dumpbin工具的使用
- windows-phone-7 – vmouse事件的问题WP7 JQueryMobile
- windows-10 – 有没有办法使用GUI管理Windows 10上的QLogic
- windows – Iscsi成立 – 任何理由我不应该做我正在做的事情
- 视频 – Windows Media Foundation使用IMFTransform将mp4电
- Windows – 如何设置Perfmon自动在系统启动时启动“警报”?
- 了解windows内部结构?
- 自定义Windows GINA身份验证
推荐文章
站长推荐
- Windows Azure和Amazon AWS之间的站点到站点VPN
- 缓存 – 如何在Windows Phone 8上清除Cordova We
- windows – RASPHONE.exe和RASDIAL.exe之间的区别
- Tutorial: Create a Windows Machine Learning U
- windows-server-2012-r2 – 发布后安装问题 – 无
- 百度网盘文件下载
- Azure Windows 2016故障转移群集
- windows – 此任务要求指定的用户帐户具有作为批
- windows – 是否有一个允许构建独立可执行文件的
- 模拟 – 确定Windows Phone 8.1应用程序是否在模
热点阅读