kemkriszt
kemkriszt

Reputation: 290

Alexa Account Linking - Expected format

I am trying to use account linking in my skill. The problem is that the documentation is not clear enough. I have the login screen, it redirects to the amazon redirect uri provided in the URL parameters, I also include the code (btw I'm using Auth Code Grant) and here comes the problem. My script gets the code and the client credentials and generates the two tokens, but what should it do with them? Does their system wait a json response or something containing the two tokens using their names as keys or should I redirect again? What do they mean in the documentation when they say the server should return the access token and the refresh token?

Upvotes: 1

Views: 1595

Answers (3)

Daniel
Daniel

Reputation: 36

The token response should look like this. I believe the exires_in and refresh_token properties are optional.

{
  "access_token": "...",
  "refresh_token": "...",
  "expires_in": 3600
  "token_type": "bearer"
}

https://developer.amazon.com/docs/alexa-voice-service/authorize-companion-site.html#auth-code-grant.

Upvotes: 2

Ragu
Ragu

Reputation: 74

Steps in Account Linking(Auth code grand flow):

• User will be redirect to form based login page, used to get the user credentials
• After validating the user credentials and user authorities by your backend security script, it will be redirect the request to authorize endpoint to generate the authorization code.
• Once the request reached the authorize end point, it will validate the client details.
• Once it is validated, user will be redirected to the approval page.
• Once we get the confirmation from the user, your backend security server script need to create the autorization code and need to give it back to the AWS alexa client.
• AWS client will call our access token end point to get the access token and refresh token.
• Once AWS client gets the access token and refresh token, the skill will be linked to the user.
• AWS Alexa client send the access token in every request once the user have linked the skill

Your Problem: AWS client will call your access token end point url along with Authorization code and client credentials, Your back-end script need to validate those inputs and need to create access token, refresh token and send it back to AWS client.
Its a POST request from AWS client, you have to return back response to same POST request.

Upvotes: 0

pip
pip

Reputation: 75

There are multiple threads on this topic from the Amazon Developer Forum I tried the tutorial referenced on a home brew AVS device (RPi3) and it works with no issue (I can get the user name etc. from my Amazon account), although I still can't figure out how to access activity api json within AVS SDK.

Upvotes: 0

Related Questions