Recently, we had a requirement to create an Alexa application for a taxi company. The client had created a mobile application for Android and IOS devices. But as a unique offering, the client wanted to implement Alexa Skill and Google Action for their user to book the ride.
We at Third Rock Techkno have created quite a few voice apps for Alexa and Google voice platforms. Hence, we were very clear about what we need to do in order to get the mobile app similar functions to the voice apps. The challenges we faced were during the part where we have to implement account linking or in layman terms Login function like we have in any application. We searched the internet but there were not many well-documented resources available. We had to go through many documents and articles. As a result of this, we decided to write a detailed post to explain each and everything step in the process of account linking.
Why Account Linking?
Account linking allows us to attribute data, action, items, etc uniquely to a user/customer/identity, in turn allowing us to cater to the user in a better way and provide user-specific service. Hence, we can fetch the respective data of that user.
When to ask the user to enable Account Linking?
- One should ask the user to log in when a function of the application requires it. Otherwise, let the user use the application freely.
- If our application requires logged users for all the action, in that case, ask for the account linking at the start when the user enables the Alexa skill.
Account linking diagram
Account Linking Flow
Now that you are aware of the flow of Account Linking, let’s begin.
Enable Account Linking in Alexa developer console
Select Auth Code Grant
Specify required parameter on account linking page
Your Authentication Scheme: HTTP BASIC
When you go for account linking in Alexa, It will first call authorization URI which you need to define in the Alexa account linking page which is shown in the below image.
When the Authorization page will open, we get the state, client_id and redirect_uri as a query string.
In the Submit method, we have to call our login API. On API success we have to redirect to the Accept/Reject URI and pass state and redict_uri in the query string.
- We got state and redirect_uri as a query string into Accept/Reject URI.
- On the Accept/Reject button, we have to call another API, that will generate a random code.
- On Success, we have to redirect to the URI which we have got. State and code need to pass with a redirect URI. That is the Alexa authentication page. That will call our Access token URI which we have mentioned in the account linking setting.
Access Token URI
- Access Token URL is going to be used for the token exchange.
- In this API, we have to get
After authentication redirect URI will redirect to the account linking success page.
We hope that you followed the steps mentioned above and Account Linking for your Alexa application has been a success. If you are facing any issues please write to us at firstname.lastname@example.org, you can also comment here and we shall get back to you. If you would like to develop your own voice application click here.
Third Rock Techkno is a leading IT services company. We are a top-ranked web, voice and mobile app development company with over 10 years of experience. Client success forms the core of our value system.
We have expertise in the latest technologies including angular, react native, iOs, Android and more. Third Rock Techkno has developed smart, scalable and innovative solutions for clients across a host of industries.
Our team of dedicated developers combine their knowledge and skills to develop and deliver web and mobile apps that boost business and increase output for our clients.