在 webhook 中使用 Google 主页访问令牌
Use Google home access token in the webhook
我的 Google 家庭应用程序有一个 webhook。该应用程序将 accessToken 发送到我的 webhook,但我无法在 actions-on-google V2.
中访问它
这就是它现在在 webhook 中的样子。变量 'token' returns 现在未定义。如何正确获取accessToken?
app.intent('help', (conv , params) => {
var help = conv.parameters[Parameters.HELP];
var token = conv.user.accessToken;
var API_URL_HELP = API_URL+"&call=help&answer="+help+"&token="+token;
var options = {
uri: API_URL_HELP,
json: true
};
return rp(options)
.then( response => {
console.log( 'response:', JSON.stringify(response,null,1) );
var value = response.msg;
return conv.close( value );
});
});
您想要的字段是conv.user.access.token
。所以
var token = conv.user.access.token;
应该可以。
我的 Google 家庭应用程序有一个 webhook。该应用程序将 accessToken 发送到我的 webhook,但我无法在 actions-on-google V2.
中访问它这就是它现在在 webhook 中的样子。变量 'token' returns 现在未定义。如何正确获取accessToken?
app.intent('help', (conv , params) => {
var help = conv.parameters[Parameters.HELP];
var token = conv.user.accessToken;
var API_URL_HELP = API_URL+"&call=help&answer="+help+"&token="+token;
var options = {
uri: API_URL_HELP,
json: true
};
return rp(options)
.then( response => {
console.log( 'response:', JSON.stringify(response,null,1) );
var value = response.msg;
return conv.close( value );
});
});
您想要的字段是conv.user.access.token
。所以
var token = conv.user.access.token;
应该可以。