Я использую пример клиента Google NodeJS с сервером выполнения DialogFlow: https://github.com/google/google-api-nodejs-client/tree/master/samples.
Сгенерировал мои учетные данные для веб-клиента Google API с URL перенаправления на https://xxxxxx.ngrok.io
Затем загрузилJSON и переименован в oauth2.keys.json в папке примеров.
{
"web": {
"client_id": "XXXXX.apps.googleusercontent.com",
"project_id": "XXXX",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "XXXX",
"redirect_uris": ["https://XXXX.ngrok.io"]
}
}
Когда я запускаю узел oauth2.js, меня перенаправляют на веб-сайт, и мне предлагается войти в учетную запись Google.У меня следующая ошибка:
keys.redirect_uris [0], TypeError: Невозможно прочитать свойство '0' из неопределенного
Сервер выполнения DialogFlow также работает наngrok address.
ОБНОВЛЕНИЕ 24 мая:
после входа в аккаунт Google:
Headers {
"host": "xxxx.ngrok.io",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/xx.x.xxxx.xxx Safari/537.36",
"accept": "image/webp,image/apng,image/*,*/*;q=0.8",
"referer": "https://xxxxxxx.ngrok.io/?code=xxxxxxxxxxxxxxxxxxxxxxxxx",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
"x-forwarded-proto": "https",
"x-forwarded-for": "xxx.xx.xx.xxx"
}
TypeError: Cannot read property 'payload' of undefined
at getRequest (/Users/xxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/conv.js:30:45)
at new DialogflowConversation (/Users/xxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/conv.js:37:22)
at Function.<anonymous> (/Users/xxxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:113:24)
at Generator.next (<anonymous>)
at /Users/xxxxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:22:71
at new Promise (<anonymous>)
at __awaiter (/Users/xxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:18:12)
at Function.handler (/Users/xxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:84:16)
at Object.<anonymous> (/Users/xxxxxx/Desktop/facts/functions/node_modules/actions-on-google/dist/assistant.js:55:32)
at Generator.next (<anonymous>)