How to obtain userId specified by Alexa user during account linking

≡放荡痞女 提交于 2019-11-28 12:10:59

问题


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.

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/54700595/how-to-obtain-userid-specified-by-alexa-user-during-account-linking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!