如何在Google对话框流程流完整时提取与google主页链接的电子邮件ID和用户名 [英] How to extract the email Id and user name, which is linked with the google home , at the fullfilment of the google dialogflow flow

查看:123
本文介绍了如何在Google对话框流程流完整时提取与google主页链接的电子邮件ID和用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户触发意图时获取与google home的链接电子邮件ID。我已按照以下链接
如何从Google Home的语音匹配配置文件中获取用户的唯一身份?

I want to get the linked email id with google home , when user triggers an intent. I have followed the following link How to get user's unique identity from google home's voice match profile?

我正在跟踪Rajat的回答,并且一直进行到第二步。

I am following Rajat's answer and have done till the 2nd step.

但是我没有在用户的对象中获取accessToken。我需要此令牌以从此api端点获取用户详细信息: https:// www.googleapis.com/oauth2/v1/userinfo?access_token=

But I am not getting the accessToken in the user's object. I neeed this token to get the user details from this api endpoint: "https://www.googleapis.com/oauth2/v1/userinfo?access_token="

相反,我是从实现JSON获取此用户对象的: {locale:'en-GB',userId:'15391770952311649498774'}

Instead I am getting this user object from the fulfillment JSON: { locale: 'en-GB', userId: '15391770952311649498774' }.

如何获取访问令牌?

How can I get the access token?

推荐答案

如果您已将OAuth服务连接到Google助手,则Google助手只会向您的操作发送 auth令牌通过帐户关联进行操作。如果您有OAuth服务器和位于其后的服务,该服务将使用auth令牌为您提供所需的信息,则此方法有效。

The Google Assistant will only send your Action an auth token if you have connected an OAuth service to your Action through Account Linking. This works if you have an OAuth server and a service behind it that will use the auth token to give you the information you want.

您正尝试获取该信息。但是,使用Google的API从userinfo端点中获取。这意味着您需要使用Google的OAuth服务器。拉贾特(Rajat)的答案为您提供了实现此目标的信息。 但是,这是行不通的。 Google不允许您将其OAuth端点用于Assistant-您必须使用自己控制的OAuth端点(例如,一个通过Auth0或自己运行的OAuth端点) 。

You're trying to get that information from the userinfo endpoint with Google's API, however. Which means you need to use Google's OAuth server. Rajat's answer gives you the information to do that. However, this won't work. Google does not allow you to use their OAuth endpoints for the Assistant - you must use an OAuth endpoint you control (such as one through Auth0, or one you run yourself).

但是仍然有一种获取所需信息的方法。

But there is still a way to get the information you want.

您可以使用 Google登录助手。在此方案中,如果用户为您的操作授予许可,您将获得一个身份令牌

You can use Google Sign In for Assistant. In this scheme, you will get an identity token if the user gives permission for your Action to get it.

您需要请求权限使用登录助手,但是如果用户授权了它,您将获得一个身份令牌,您可以对该身份令牌进行解码(无需将其发送给服务)以获取可能包含其姓名和电子邮件的公共资料信息地址。

You will need to request permission using a sign-in helper, but if the user authorizes it, you'll get an identity token which you can decode (you don't need to send it to a service) to get public profile information which may include their name and email address.

这篇关于如何在Google对话框流程流完整时提取与google主页链接的电子邮件ID和用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆