Related Resources

Our Services

You May Also Like

How to implement account linking for ALEXA skill?

Krunal Shah

May 15, 2020

4 min readLast Updated Dec 12, 2022

Introduction

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?

  1. One should ask the user to log in when a function of the application requires it. Otherwise, let the user use the application freely.
  2. 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

Authorization Flow

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.

Accept/Reject URI:

  1. We got state and redirect_uri as a query string into Accept/Reject URI.
  2. On the Accept/Reject button, we have to call another API, that will generate a random code.
  3. 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

  1. Access Token URL is going to be used for the token exchange.
  2. In this API, we have to get

access_token: "EXAMPLEACCESSTOKEN123456",

token_type: “bearer”

expires_in: 3600,

refresh_token: "EXAMPLEREFRESHTOKEN123456X"

device_id: “”

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 contact@thirdrocktechkno.com, 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.

Projects Completed till now.

Discover how we can help your business grow.

"Third Rock Techkno's work integrates complex frameworks and features to offer everything researchers need. They are open-minded and worked smoothly with the academic subject matter."

- Dr Daniel T. Michaels, NINS