Как войти в систему с помощью Google надстройки Microsoft Word - PullRequest
0 голосов
/ 09 декабря 2018

В приведенной ниже ссылке предлагается использовать Google Auth Lib, но предоставленная ссылка github не относится к какой-либо библиотеке javascript:

Насколько я знаю, я не могу использовать Code FLow, так как для этого требуется URL-адрес перенаправления.Как мне получить Access Token от Google в Microsoft Word Add-In?

1 Ответ

0 голосов
/ 09 декабря 2018

Для входа в систему с помощью 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);
}

Вот и все!

...