服务器到服务器身份验证失败 - firebase - dialogflow - google 上的操作 - 用户实体 v2
server to server auth failure - firebase - dialogflow - actions on google - user entity v2
这里是我用来获取访问令牌以创建会话实体的代码,如此处所述:https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.sessions.entityTypes
以前代码可以找到,但突然停止工作,现在它返回 firebase 函数中未定义的访问令牌,这里是不工作的代码:
export const rough = functions.https.onRequest((request, response) => {
var { google } = require('googleapis');
const cred = {
serviceAccountEmail: "dialogflow-abc@abc-abc.iam.gserviceaccount.com",
privateKey: "-----BEGIN PRIVATE KEY-----abcdkey---END PRIVATE KEY-----\n"
}
// getting server to server OAuth token
const serviceAccountAuth = new google.auth.JWT({ // key is private key, extracted from service-account json file
email: cred.serviceAccountEmail,
key: cred.privateKey,
scopes: ['https://www.googleapis.com/auth/cloud-platform']
})
console.log(serviceAccountAuth);
const _tokenData = serviceAccountAuth.authorize().then(tokenData => {
console.log("tokenData: ", tokenData)
}) })
代码是正确的,因为这段代码在我的机器上仍然可以正常工作看看:
我机器中的代码:(工作)
firebase 函数中的相同代码:(不工作)
如果我 运行 在 firebase 函数模拟器中使用相同的函数它工作正常
本地模拟器(工作中)
我的代码开始自动像以前一样工作
这是由于 google
发生的事件
Investigating an issue with Cloud Functions for Firebase
Incident began at 2018-12-15 04:00 and ended at 2018-12-15 13:15 (all
times are US/Pacific).
https://status.firebase.google.com/incident/Functions/18044
现在事件已回滚,这就是我相信我的代码再次开始正常工作的原因
当我在其他几个地方发布这个问题时,包括他们的松弛通道和不同的 github firebase 和 google api 回购,我意识到我不是唯一的人面对这个问题,有更多人在功能和存储等不同服务中报告类似问题,他们的代码运行良好但现在抛出错误
这里是我用来获取访问令牌以创建会话实体的代码,如此处所述:https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.sessions.entityTypes 以前代码可以找到,但突然停止工作,现在它返回 firebase 函数中未定义的访问令牌,这里是不工作的代码:
export const rough = functions.https.onRequest((request, response) => {
var { google } = require('googleapis');
const cred = {
serviceAccountEmail: "dialogflow-abc@abc-abc.iam.gserviceaccount.com",
privateKey: "-----BEGIN PRIVATE KEY-----abcdkey---END PRIVATE KEY-----\n"
}
// getting server to server OAuth token
const serviceAccountAuth = new google.auth.JWT({ // key is private key, extracted from service-account json file
email: cred.serviceAccountEmail,
key: cred.privateKey,
scopes: ['https://www.googleapis.com/auth/cloud-platform']
})
console.log(serviceAccountAuth);
const _tokenData = serviceAccountAuth.authorize().then(tokenData => {
console.log("tokenData: ", tokenData)
}) })
代码是正确的,因为这段代码在我的机器上仍然可以正常工作看看:
我机器中的代码:(工作)
firebase 函数中的相同代码:(不工作)
如果我 运行 在 firebase 函数模拟器中使用相同的函数它工作正常
本地模拟器(工作中)
我的代码开始自动像以前一样工作 这是由于 google
发生的事件Investigating an issue with Cloud Functions for Firebase
Incident began at 2018-12-15 04:00 and ended at 2018-12-15 13:15 (all times are US/Pacific). https://status.firebase.google.com/incident/Functions/18044
现在事件已回滚,这就是我相信我的代码再次开始正常工作的原因
当我在其他几个地方发布这个问题时,包括他们的松弛通道和不同的 github firebase 和 google api 回购,我意识到我不是唯一的人面对这个问题,有更多人在功能和存储等不同服务中报告类似问题,他们的代码运行良好但现在抛出错误