We are happy to announce two frequently requested Alexa Skills Kit features are now live! Starting today you can take advantage of Account Linking allowing customers to easily link their accounts with yours and a new Service Simulator for testing your skill.
What is Account Linking?
With the Alexa Skills Kit, you can now easily allow your customers to link their existing accounts with you, to Alexa. To link accounts, customers visit the skills tab in the Amazon Alexa app and enable your skill. They are then prompted to log in to your site using their normal credentials. You authenticate the customer and generate an access token that uniquely identifies the customer and link the accounts.
Setting Up Account Linking in Your Alexa Skill
To connect an Alexa user with an account in your system, you need to provide an access token that uniquely identifies the user within your system. The Alexa Skills Kit uses an OAuth 2.0 implicit grant authorization to obtain this access token. The resource server and authorization server are both part of your system and the client seeking access is the Alexa service. Once an Alexa user grants the Alexa service access to the resource server, the Alexa service stores the access token. This token is then included in requests sent to your skill.
How End Users Set Up Account Linking for a Skill
Users link their accounts using the Amazon Alexa app. Note that users must use the app. There is no support for establishing the link solely by voice.
Users normally start the process when initially enabling your skill in the app:
- In the Alexa app, the user enables the skill.
- The app displays your login page right within the app, using the authorization URL you provide when registering your skill on the developer portal. When the companion app calls this URL, it includes state, client_id, and scope as query string parameters.
- The state is used by the Alexa service during the account linking process. Your page needs to keep track of this value, as you must pass it back later.
- The client_id is defined by you. Your login page can use this to determine that the request came from your Alexa skill.
- The scope is an optional list of access scopes indicating the level of access requested. You define the set of scopes to support when enabling account linking for your skill.
- The user logs in using their normal credentials for your site.
- Your service authenticates the user and then generates an access token that uniquely identifies the user in your system.
- Your service redirects the user to an Amazon-specific URL and passes along the state, access_token, and token_type in the URL fragment.
- The Alexa service validates the returned information and then saves the access_token for the Alexa user.
At this point, the skill is enabled, the user’s Alexa account is linked to the account in your service, and the skill is ready to be used.
What Do You Need to Add Account Linking to Your Skill?
To use account linking support in the Alexa Skills Kit, you must have a web-based service that authenticates users. You need a login page that can collect the user’s credentials and then generate an access token that uniquely identifies that user.
To add account linking to your skill, you must do the following:
This is a developer only release and we will be making improvements to the end user experience in the Alexa app over the next few weeks. Learn more about how to enable Account Linking in your skill here.
Need help testing your skill? Now you can use the new Service Simulator on the developer portal to test your skill service without an Alexa-enabled device. You simply input text and view the service input and service output on the screen.
The Service Simulator allows you to test skills without an Alexa enabled-device. To access this simulator, please sign into your developer’s account and go to “Apps & Services” > “Alexa”.
Once you are in the Alexa section, please click on the “Edit” button next to one of your Alexa kill submission and select “Test” on the left hand side.
The two ways you can test your skill are:
- By typing in a sample utterance you will see the request your service will get and the resulting response.
- By sending your end point a JSON request you will see your services' JSON response.
You may also want to check out these additional Alexa developer resources:
An Introduction to the Alexa Skills Kit (ASK)
Free Video Training - An Introduction to Amazon Echo and the Alexa Skills Kit
Creating an Amazon Echo Adventure Game with the Alexa Skills Kit
New Alexa Episode on the AWS Podcast