This tutorial will teach you how to use Account Linking in Voiceflow via the Amazon Developer Console.
First, login to the Amazon developer console
Then click on "Login with Amazon Console"
Create a New Security Profile
Fill all the informations on the next screen and hit Save
Back to the main screen, click on Show Client ID and Client Secret
and copy your Client ID and Client Secret to a text editor so they're easily available. You’ll need these values later in the process.
In your Voiceflow project, go to the Tools tab and click on Link Account
Fill all the informations like this:
URL Authorization: https://www.amazon.com/ap/oa
Access Token URL: https://api.amazon.com/auth/o2/token
Client ID: Your client id copied before
Client Secret: Your client secret copied before
Access Token Expiration: Clear the field (remove the 3600)
Client Authentication Scheme: leave it to HTTP Basic
Now go to the Scope tab and add profile in Scopes
Go back to your Canvas and drag and drop the User Info and the Permission block from the User section of the left toolbar.
At the same time, add two speak blocks to your project.
You should end up with something like this
Select the User Info block and add permission by clicking on + Add Permission Request.
Choose Account Linking from the drop-down list and select access_token for Map Access Token To
Select the Permission block and click on the tab Account Linking
In the speak block right below the Permission block, type a texte like this one to inform the user of the procedure to follow to authenticate with your skill.
You will have to allow this skill in your Alexa mobile application or from alexa.amazon.com Once this is done, please restart this skill again by saying: Alexa, open *invocationname*
Finally, on the last speak block, at the right of the User Info block, write a simple text to be able to debug the token we will receive after authentication.
Connect all the blocks as below and upload your skill to Alexa.
In the ADC (Alexa Developer Console), click on the Build tab
Then at the bottom of the screen, click on ACCOUNT LINKING
On the ADC Account Linking page, copy the three Redirect URLs to a text editor so they're easily available.
Back on the Login With Amazon page, click on the small gear in front of the profile you created earlier.
And choose Web Settings
Click the Edit button
Paste the three urls you just copied from ADC and hit Save
Go back to ADC, click on the Test tab and test you skill
Visit alexa.amazon.com or open the Alexa mobile application to authorize the skill
Finally, go back to ADC and re-test your skill to make sure everything works. You should get your token.
To complete the test, go back to your project in Voiceflow , add two new variables: name and email
Then and add an Integration block. right after the User block (you don't the Debug speak block anymore).
Set a GET Request in the API settings with this url:
For the Mapping output, just map your variable like this:
response.name -> name
response.email -> email
All that remains is to add a speak block
Upload and test your skill again in ADC, you should get a result like this one.