根据Google动作sdk文档https://developers.google.com/actions/identity/account-linking
我已按照启用帐户关联的所有步骤操作。 当调用任何意图时,我正在检查用户是否已通过
登录let accessToken = app.getUser().accessToken;
if ('' + accessToken === 'undefined') {
console.log('Inside not logged In');
app.askForSignIn();
}
并将响应发送为
{
"conversationToken": "{\"state\":null,\"data\":{}}",
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"initialPrompts": [
{
"textToSpeech": "PLACEHOLDER_FOR_SIGN_IN"
}
],
"noInputPrompts": []
},
"possibleIntents": [
{
"intent": "actions.intent.SIGN_IN",
"inputValueData": {}
}
]
}
]
}
应该在设备上调用身份验证流程。 虽然谷歌助理说的如下。
{
"response": "test application isn’t responding right now. Try again soon.\n",
"conversationToken": "GhBzaW11bGF0b3JfZGV2aWNl",
"audioResponse": "//NExAASW...",
"debugInfo": {},
"visualResponse": {}
}
我已经尝试过文档中给出的所有内容。 你能否帮助使用动作SDK而不是谷歌助手的API.AI来实现登录功能?
以下是API.AI对google助手的响应,以调用正在运行的身份验证流程。
这是API.AI生成的用于调用用户身份验证的响应。
{
"response": "It looks like your test app account is not linked yet",
"conversationToken": "GhBzaW11bGF0b3JfZDV2aWNl",
"audioResponse": "//NExAAQ+...",
"debugInfo": {
"sharedDebugInfo": [
{
"name": "Account Linking Url",
"debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider=pathway-171404_dev&scopes=test&return_url=https://www.google.com/"
}
]
}
}
我们有没有办法在node.js文件的Actions SDK中生成这个响应?
Actions.json文件:
{
"actions": [
{
"description": "Launch intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "mainConversation"
},
"intent": {
"name": "actions.intent.MAIN"
}
},
{
"description": "Sign In intent",
"name": "SIGN_IN",
"fulfillment": {
"conversationName": "mainConversation"
},
"intent": {
"name": "actions.intent.SIGN_IN"
}
}
],
"conversations": {
"mainConversation": {
"name": "mainConversation",
"url": "https://4541d296.ngrok.io/pathway-171404/us-central1/conversationComponent",
"fulfillmentApiVersion": 2
}
}
}