Account Linking Concepts for Alexa Skills
Account linking is needed when the skill needs to connect with a system that requires authentication.
What is the first step?
We need to login into the Amazon developer console. Here is the link
https://developer.amazon.com/dashboard
New users please Signup. If already have an account please Sign in.
after login, you may get this interface
Just click on the Alexa skill kit option.
You will now redirect to your skill page.
If not getting this page, don't worry there is another way to reach out.
Just click on the three-dot icon in the top left.
Then click on the Amazon developer console option.
After that, we need to create a skill by clicking create skill option, which is clearly visible in the upper image.
Need to give name (ex: account linking ) of your skill.
Need to choose start from a scratch template.
After that just click on the continue with template option on the top right side.
Users say a skill’s invocation name to begin an interaction with a particular custom skill. We need to set a skill invocation name.
You can give any name (Ex: do it)
Please remember after doing any small changes here need to click on the save model(which will save your changes ) after that click on the Build model(which will help Alexa to train )
Click on the Models option.
Next click on the Account Linking option.
Need to make a checkmark on these two options and save them.
Fill Web Authorization URI and Access Token URI as it is.
The URI of your authorization server, which provides the Alexa service with an authorization code. The Alexa service calls the authorization URI with these query parameters.
The URI of your token server, which is the endpoint of your authorization server that can receive an authorization code and return an access/refresh token pair that the Alexa service can use to access the user’s data in your system. The Alexa service makes a POST request to the access token URI and includes the authorization code in the parameters. The token server responds and includes the access/refresh tokens in JSON.
For a list of requirements regarding access tokens, see Access token URI requirements.
Next, we need Client ID and Secret. That going to link Our skill With login with amazon profile.
Click on the Settings option.
Click on the Security profiles option.
https://developer.amazon.com/settings/console/myaccount.html
Click on the create a new security profile option.
Fill in Security Profile Name and Security Profile Description (any name and description) and save.
Click on the Web setting option
You will get the client id and Client Secret
We need some return URLs (where users will be redirected during account linking).
Let's move back to the account linking option
copy Alexa Redirect URLs
again come back to the security profile section and click on the edit option.
copy here all three redirected URLs and save
Now as we already get the client id and secret just move back to the account linking section and fill the credentials there
add scope to profile:user_id which will give user id during account linking and save it.
Click on the code section, let's jump to the coding section in Alexa
Here is the code :
Now it’s ready for testing, let’s do that…
Click on the test option
Enter or say invocation name which is “do it ”
we get a response from Alexa is Please use the Alexa app to authenticate with your Amazon account to start using this skill.
Because right now our skill name which is account linking is not linked properly.
let’s jump to the Alexa app inside (mobile version) enable the skill and link then come back again and retest.
Need to login in to the Alexa app with the same login and password which you used in the Alexa developer console.
After logging in click on the setting option
Click on the skill and find out your skill(Ex: account linking ), then click on that skill.
Click on the setting option.
Click on the link account option.
The user will redirect to the login section again just fill in your same login id and password.
After login, you get a successful message.
Let’s come again to testing section and test again.
Congratulations your account has been linked and now you are successfully authenticated by Alexa.
The videos below will give you a good idea of how the technology works.👇
In case you’re interested in more technical videos, check out this channel .👇
Start your journey towards having a chatbot at a reasonable price. We’ll be pleased to serve you. 🙂
Here is our Website Link :- https://axlewebtech.com/