据我所知,我不能使用 Code FLow ,因为它需要一个重定向URL . 我应该如何从 Microsoft Word Add-In 中的 Google 获得 Access Token ?
1 回答
0
要使用 Google , Facebook 等登录,您可以使用 office-js-helpers :
使用 npm 安装它:
npm install --save @microsoft/office-js-helpers
在您的代码中, Office.initialize 内:
Office.initialize = function (reason) {
//...
// This to inform the Authenticator to automatically close the authentication dialog once the authentication is complete.
if (OfficeHelpers.Authenticator.isAuthDialog()) return;
// register Google endpoint using
authenticator.endpoints.registerGoogleAuth('GOOGLE-CLIENT-ID');
authenticator
.authenticate(OfficeHelpers.DefaultEndpoints.Google)
.then(function (token) { console.log('_GOOGLE_TOKEN: ', token); })
.catch(OfficeHelpers.Utilities.log);
}
1 回答
要使用
Google
,Facebook
等登录,您可以使用office-js-helpers
:使用
npm
安装它:在您的代码中,
Office.initialize
内:而已!