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