简体   繁体   English

Google登录助手时出错

[英]Error in Google Sign in for the Assistant

I am using "Google Sign-in for the Assistant" for Account Linking, and implement the Google Sign-In only flow. 我正在使用“用于助理的Google登录”进行帐户关联,并实施“仅Google登录”流程。 At the first time when user invoke an app (eg: "Talk to my Test App"), it works fine ask for permission for taking name, profile picture, email from the google and Successfully get the info. 在用户首次调用某个应用程序时(例如:“与我的测试应用程序对话”),它可以很好地运行以获取姓名,个人资料图片,来自Google的电子邮件的许可,并成功获取信息。 But when i invoke an app second time it does not responding and receiving error in the logs: "App with account linking returned authentication error. Removing stored OAuth token." 但是,当我第二次调用应用程序时,它没有响应并在日志中收到错误: “具有帐户链接的应用程序返回了身份验证错误。删除存储的OAuth令牌。” i didn't understand whats happening here, following is my code i am using as a webhook, 我不明白这里发生了什么,以下是我用作网络挂钩的代码,

 const app = actionssdk({ debug: true }) app.intent('actions.intent.MAIN', (conv) => { conv.ask(new SignIn('To get your account details')) conv.ask('Hello') }) app.intent('Default Welcome Intent', conv => { conv.ask(`Hello test version`) }) app.intent('actions.intent.SIGN_IN', (conv, input, signin) => { if (signin.status === 'OK') { const payload = conv.user.profile.payload conv.ask(`I got your account details, ${payload.name}. What do you want to do next?`) } else { conv.ask(`I won't be able to save your data, but what do you want to do next?`) } }) 

Your app makes a user sign in every time a user launches your app. 每次用户启动您的应用时,您的应用都会使用户登录。 So if a user is a returning user (second time), system tries to remove/recreate profile about the user because that person is already signed in. So you should write in a way that the user does not fall into the sign in flow after the second time. 因此,如果用户是回访用户(第二次),则系统会尝试删除/重新创建有关该用户的配置文件,因为该用户已经登录。因此,您应采用以下方式编写该用户,使其不会陷入登录流程中第二次。

app.intent('welcome', conv => {
     const payload = conv.user.profile.payload;
     if (!paylaod) {
         return conv.ask(new SignIn('to sign in);
     }
     conv.ask('hi! ${payload.given_name}, how are you?')
})

This might work fo you. 这可能对您有用。

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

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