简体   繁体   English

如何将帐户从后端服务器绑定到Google助手用户

[英]How to tie an account from a backend server to a google assistant user

I have a web application setup to handle webhook requests from an Actions-on-Google/Dialogflow application using the Google Assistant. 我有一个网络应用程序设置,可以使用Google助手处理来自Google Actions / Dialogflow应用程序的webhook请求。 Users don't need to sign-in to a google account in order to use my web application and I'd prefer to keep it that way, so that users can sign in with any email address. 用户无需登录到Google帐户即可使用我的网络应用程序,我希望保持这种方式,以便用户可以使用任何电子邮件地址登录。

I also want my users to be able to interact with my application using the Google Assistant, and be able to access personal/contextual data via the assistant (ie when a speaker says, "what's on my shopping list", the web app needs to be able to know what my means). 我还希望我的用户能够使用Google助手与我的应用程序进行交互,并能够通过该助手访问个人/上下文数据(即,当说话者说“我的购物清单上有什么”时,Web应用程序需要能够知道我的意思)。

Currently, I have this working by using my web app to issue a unique short code to my user (in the web app UI) and then with an intent on the Assistant where the speaker says "My code is 1-2-3-4" and then my web app can identify the user from then on (by saving the userId from the webhook request to whatever user got the short code 1234 and then using that userId to lookup the user on each subsequent request.) 目前,我正在通过使用Web应用程序(在Web应用程序UI中)向用户发布唯一的短代码,然后在助手上意图使说话者说“我的代码是1-2-3-4 ”,然后我的Web应用可以从此识别用户(通过将webhook请求中的userId保存到任何获得短代码1234的用户,然后使用该userId在每个后续请求中查找该用户)。

My question is, is there a better way to do this? 我的问题是,有更好的方法吗? Ideally, in my web app, I'd like to have something like an "Authorize Google Assistant" button, which would then link the user's google account to their web-app account, so that the conversation on the Assistant is seamless. 理想情况下,在我的Web应用程序中,我想要一个类似“授权Google Assistant”按钮的按钮,然后将用户的google帐户链接到其Web应用程序帐户,以便在Assistant上进行无缝对话。

Has anyone done this before? 有人做过吗? Thanks 谢谢

This is the perfect use case for Account Linking with the Google Assistant. 这是与Google Assistant进行帐户链接的理想用例。

From your users' perspective, they will start to use your Action. 从用户的角度来看,他们将开始使用您的操作。 If they're doing so through a speaker and they haven't linked the account yet, they'll be directed to a mobile device to do so. 如果他们是通过演讲者这样做的,并且尚未关联该帐户,那么他们会被定向到移动设备上。 On a mobile device, they'll be redirected to a page on your website where they will been to authenticate themselves and authorize your server to let them in through the Assistant. 在移动设备上,它们将被重定向到您网站上的页面,在那里他们将进行身份验证并授权您的服务器通过Assistant进入。 Once they have done so, they won't need to log in again, the accounts will be linked, and they'll be able to use the voice Action without further obstruction. 一旦这样做,他们将无需再次登录,帐户将被链接,并且他们将能够使用语音操作而不会受到进一步的阻碍。

From your perspective as a developer, you'll need to setup an OAuth2 server (I suggest the code flow). 从开发人员的角度来看,您需要设置OAuth2服务器(我建议代码流)。 That login process I mentioned is the first step in the OAuth dance, and will end up with you issuing a code to Google. 我提到的登录过程是OAuth跳舞的第一步,最终将为您向Google发送代码。 They will then exchange this code for an Auth Token (with a limited lifetime) and a Refresh Token (which does not expire). 然后,他们将用此代码交换Auth令牌(具有有限的生存期)和Refresh Token(不会过期)。 They will periodically use the Refresh Token to get new, valid, Auth Tokens for this user. 他们将定期使用刷新令牌为该用户获取新的有效身份验证令牌。 When the user issues a voice command, the Auth Token will be passed as a field in the JSON to your fulfillment server, and you can use this to verify who the user is and that they are authorized to use your service. 当用户发出语音命令时,身份验证令牌将作为JSON中的字段传递给您的履行服务器,您可以使用它来验证用户身份以及他们是否有权使用您的服务。

暂无
暂无

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

相关问题 如何识别允许的用户Google日历API授权请求Gmail帐户 - How to identify allowed user google calendar api authorization request gmail account springboot google oauth2 和后端授权 - springboot google oauth2 and authorization from backend 将应用程序认证/授权到Google帐户,而无需用户交互。 即应用程序的Google帐户 - Authenticate/Authorize application to google account without user interaction. i.e. application's google account 根据Google或其他帐户在自己的站点上注册用户帐户 - User account registration at own site based on Google or other accounts 身份验证后如何从后端重定向到前端 - How to Redirect From Backend To FrontEnd after Authentication 如何在ASP.net MVC中将对象列表与用户(Account)关联 - How to associate list of objects with user(Account) in ASP .NET MVC 如何使用 OAuth 2.0 for BigQuery API 对最终用户进行身份验证,并将 python 作为云函数中的后端代码 - How to authenticate an end user with OAuth 2.0 for BigQuery API with python as a backend code in cloud function 使用GWT中的Google帐户进行授权/身份验证 - Authorization/Authentication with Google account in GWT 如何将授权用户从一个应用程序传递到同一服务器上运行的另一个应用程序? - How do i pass authorized user from one application to another running in same server? 我如何针对来自身份服务器(Wso2is 5.4.0)的SAML断言授权用户 - How can i authorized a user against SAML Assertion coming from Identity server(Wso2is 5.4.0)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM