如何在帐户链接期间获取Alexa用户指定的userId [英] How to obtain userId specified by Alexa user during account linking

查看:114
本文介绍了如何在帐户链接期间获取Alexa用户指定的userId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在帐户链接过程中,Alexa用户将被重定向并显示一个表单以输入其凭据(ID和/或密码)。根据提供的内容,然后通过身份验证流程对用户进行验证,成功后, accessToken 会嵌入到Alexa请求中,并将用户重定向到OAuth资源。

During account linking process, Alexa user is redirected and presented with a form to enter his credentials (ID and/or password). Based on what's provided, the user is then being validated by the authentication flow, upon which success an accessToken is embedded in Alexa request and the user is redirected to the OAuth resource.

是否可以通过上述交互获得的用户ID作为Alexa请求的一部分(JSON session\user\ \userId ),而不是(或除此之外)是在用户启用设备技能时生成的userId吗?还是可以从链接用户帐户后生成的 accessToken 中收集userId?

Is there a way to pass the ID of the user obtained in the above interaction as part of the Alexa request (JSON session\user\userId), instead of (or in addition to) it being a userId that gets generated during user's enabling their skill on a device? Or can the userId be gleaned from the accessToken generated after linking user's account?

推荐答案

您是否指的是OAuth提供商指定的userId?应该有一个基于 accessToken 来检索userId的API。例如,当您验证访问令牌,它将作为响应的一部分返回 user_id

Are you referring to the userId specified by your OAuth provider? There should be an API to retrieve the userId based on the accessToken. Using Login with Amazon for example, when you verify the access token, it would return user_id as part of the response.

如果是指获取用户的电子邮件(即登录到亚马逊帐户的 ID),您需要添加相关范围(例如 配置文件 (对于LWA),基于您的OAuth提供者,以便从 accessToken

If you're referring to getting the user's email (that's the "ID" to login to an Amazon account), you would need to add the relevant scope (e.g. profile for LWA) based on your OAuth provider in order to retrieve that from an accessToken.

这篇关于如何在帐户链接期间获取Alexa用户指定的userId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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