'How do i get the access token from the reques

I'm using account linking on amazon and I've managed to configure it to send my user's acessToken by a Json. I looked in the amazon documentation and it says that I can find the token in context.System.user.accessToken but I can't find this path in my code, could you help me? I guess i need to make an interceptor to get this request and the token, but i have no idea how.

JSON Input with acessToken

Token path



Solution 1:[1]

Within the handle function of your intentHandler, the argument handlerInput contains the access token. It is sent for each request:

const { accessToken } = handlerInput.requestEnvelope.context.System.user;

You can also have it within the user's session:

const { accessToken } = handlerInput.requestEnvelope.session.user;

The accessToken field does not appear if null

More detail about Alexa requests in the documentation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 callmemath