简体   繁体   English

谷歌上的行动,Oauth帐户链接

[英]actions on google, Oauth account Linking

I have been trying to connect an assistant action to my backend server I am using my own Oauth server and followed the instructions on https://developers.google.com/actions/identity/oauth2?oauth=code I am using actions_intent_Sign_in for my dialogflow event intent (like https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation_helper.signin.html ) when i use my action to sign in, i get the login window to my server, i do the account linking and i can see that i generated the tokens on my server but i cant find the token in (conv.user.access.token) 我一直在尝试将助手操作连接到我的后端服务器我正在使用自己的Oauth服务器,并按照https://developers.google.com/actions/identity/oauth2?oauth=code上的说明操作我正在使用actions_intent_Sign_in对话框事件意图(如https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation_helper.signin.html )当我使用我的操作登录时,我获得登录窗口我的服务器,我做帐户链接,我可以看到我在我的服务器上生成令牌但我无法在(conv.user.access.token)中找到令牌

and this is the code for my intent using "actions on google sdk " 这是我使用“google sdk上的操作”的意图的代码

 'use strict'; var _ = require('lodash'); var path = require('path') var express = require('express') var http = require('http') const bodyParser = require('body-parser'); var expressApp = express().use(bodyParser.json()); var server = http.createServer(expressApp).listen(3000) const { dialogflow, SignIn } = require('actions-on-google'); const app = dialogflow({ debug: true, clientId: '7b4a6dfc-4b35-11e9-8646-d663bd873d93' }); app.intent('Start Sign-in', conv => { conv.ask(new SignIn()); }); app.intent('Get Sign-in', (conv, params, signin) => { console.log("get sign in "); console.log(JSON.stringify(signin)); if (signin.status === 'OK') { const access = conv.user.access.token console.log("the access token is " + access); conv.ask('Great, thanks for signing in! What do you want to do next?'); } else { conv.ask('I wont be able to save your data, but what do you want to do next?.'); } }); 

and the response comes back as 并且响应回来了

 {"@type":"type.googleapis.com/google.actions.v2.SignInValue","status":"OK"} the access token is undefined Response { "status": 200, "headers": { "content-type": "application/json;charset=utf-8" }, "body": { "payload": { "google": { "expectUserResponse": true, "richResponse": { "items": [ { "simpleResponse": { "textToSpeech": "Great, thanks for signing in! What do you want to do next?" } } ] } } } } } 

the user object of conv has only this data conv的用户对象只有这些数据

 "user": { "raw": { "lastSeen": "2019-03-20T12:46:23Z", "locale": "en-US", "userId": "okdhyeGSk5tofgLjEepIUrA6mmewCESY8MjklZRPvQJgv6-uybfPobwdfgtrGZJ3bE2sM9ninhst" }, "storage": {}, "_id": "okdhyeGSk5tofgLjEepIUrA6mmewCESY8MjklZRPvQJgv6-uybfPobwdfgtrGZJ3bE2sM9ninhst", "locale": "en-US", "permissions": [], "last": { "seen": "2019-03-20T12:46:23.000Z" }, "name": {}, "entitlements": [], "access": {}, "profile": {} } 

i dont know where the access/refresh token can be found or if there is any requirement for the post to send from my oauth server that i missed 我不知道在哪里可以找到访问/刷新令牌,或者是否有任何要求从我的oauth服务器发送我错过的帖子

so finally i managed to get it working with the help of Actions on Google Support Team 所以最后我设法让它在Google支持团队的操作帮助下工作

the problem was me having another google account logged-in in another tab, even though i had the AoG and dialogflow agent connected with the same account 问题是我有另一个谷歌帐户登录在另一个选项卡,即使我有AoG和dialogflow代理连接到同一个帐户

tried all using incognito window and it works 尝试所有使用隐身窗口,它的工作原理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM