1
我的工作Excel Web Add-In
。我正在使用OfficeDev/office-js-helpers库来验证用户。以下代码工作正常。但我不知道如何获得用户的电子邮件,用户名等如何使用Office-js-helper的身份验证获取用户信息?
是否有OfficeDev/office-js-helpers
任何可用的功能,通过它我可以得到用户信息?
if (OfficeHelpers.Authenticator.isAuthDialog()) {
return;
}
var authenticator = new OfficeHelpers.Authenticator();
// register Microsoft (Azure AD 2.0 Converged auth) endpoint using
authenticator.endpoints.registerMicrosoftAuth('clientID');
// for the default Microsoft endpoint
authenticator
.authenticate(OfficeHelpers.DefaultEndpoints.Microsoft)
.then(function (token) {
/* My code after authentication and here I need user's info */ })
.catch(OfficeHelpers.Utilities.log);
代码示例将会非常有用。
谢谢回答。在OfficeDev/office-js-helpers中没有任何干净的代码示例可以获取用户的基本信息?您提供的链接的理论概念更多,但代码样本更少 – user3881465