账号绑定时如何获取Alexa用户指定的userId [英] How to obtain userId specified by Alexa user during account linking

查看:29
本文介绍了账号绑定时如何获取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 sessionuseruserId),而不是(或除此之外)它是在用户在设备上启用他们的技能期间生成的 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 sessionuseruserId), 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 吗?应该有一个 API 来根据 accessToken 检索 userId.例如,当您 验证访问令牌,它将返回 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"),则需要添加相关范围(例如 profile for 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天全站免登陆