0

在下面的链接中建议使用Google Auth Lib,但github提供的链接不引用任何 javascript 库:

据我所知,我不能使用它,Code FLow因为它需要重定向 URL。我应该怎么Access Token进去GoogleMicrosoft Word Add-In

4

1 回答 1

0

为了使用 , 等登录GoogleFacebook您可以使用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);
}

而已!

于 2018-12-09T10:02:38.830 回答