LoginRadius Alexa Demo
Alexa Skills Kit (ASK) is the official collection of tools, documentation, and APIs for development on Amazon's Alexa voice service. This document goes over with the process of configuring our Alexa Demo with the account linking process.
Prerequisites
Configure
This section will take you through all the necessary steps that you need to follow for configuring the Alexa Demo.
-
Navigate to Alexa Developer Console and click on Create skill option. It will open the next page where you should enter the name of Skill. Select Custom model from "Choose a model to add to your skill". Once done, click on Create skill.
-
Navigate to the next page and the following screen will appear and choose the template as Start From Scratch.
-
Navigate to the next page and the following screen will appear. From the left hand side menu, click on Invocation. Now add Skill Invocation Name. This invocation name will be used to begin an interaction with a particular custom skill.
-
Now, to configure endpoint, you have to provide ARN of Aws Lambda function if you have selected service endpoint type as "AWS Lambda ARN". You can get ARN when the lambda function is completely configured.
-
To Build your skills model, you need at least one Utterances. In other words you can say that utterance is a phrase a customer can speak to invoke the intent. To add that, click on Intents from the left-hand side menu and add one intent with any name of your choice and add the required utterances as shown in the following screenshot. Once done click on "Save Model".
-
Now, to configure account linking with LoginRadius, go to account linking section at the bottom left as shown in the following screenshot:
-
On the "Account Linking" page you can enable the service by clicking the toggle. Enable the toggle option to allow customers to create an account or link to an existing account, as shown in the following screen:
You need to fill each field as per the instructions provided below:
- In settings uncheck "Allow users to enable skill without account linking"
- Select an authorization grant type: Choose "Auth Code Grant".
- Authorization URI: https://cloud-api.loginradius.com/sso/oauth/redirect
- Access Token URI: https://cloud-api.loginradius.com/sso/oauth/access_token
- Client Id:
<< Your LoginRadius API Key >>
- Client Secret:
<< Your LoginRadius API Secret >>
- Client Authentication Scheme: From the dropdown, select "Credentials in request body".
- Scope: You must provide the desired scopes as per our LoginRadius OAuth 2 Single Sign On Documentation. e.g. r_basicprofile
- Domain List:
- Provide the LoginRadius Cloud API Address: cloud-api.loginradius.com
- Your LoginRadius sitename address: your-loginradius-sitename.hub.loginradius.com
- Default Access Token Expiration Time: To ensure that the token is not stored and usable indefinitely, Amazon allows you to set an expiration time.
- Redirect URLs: Amazon will provide you with a list of addresses to be used for redirecting the Customer as part of the authorization process, make sure you add them in your LoginRadius Admin Console under: Deployment ➔ Configuration ➔ App
-
Once you have filled out all of the configurations, Account Linking will happen when the customer enables the skills on Alexa App or if you're building a Custom Skill, you can send a Link Account card via your Alexa Skill. This can be done via the linkAccountCard function if you're using the alexa-skills-kit-sdk-for-nodejs.
-
Account Unlinking happens automatically via the Alexa App when a customer disables your skill.
-
For the next steps, you will be required to deploy the demo and complete steps to steps have been explained in the next section.
Deploy and Run the demo
Steps to configure Alexa Demo on Aws Using Lambda Function
Create a deployment package for Aws Lambda
-
Clone the GitHub repo for the demo.
-
Configure the file index.js to match your API Key.
-
Add Alexa Skill Id in index.js File, you will get skill id while configuring Alexa Skill. In your terminal:
- cd to directory
- npm install
-
Go to the root directory of "demo-alexa-customer-identity" and select all files and folder and create a zip archive.
- This zip Archive should be uploaded to Aws Lambda function
Aws Lambda Setup
Step to Create Lambda Function
-
First of all select "Author from Scratch" and provide function name as per choice and click on create a function to create a new lambda function.
-
After creating a lambda function, add trigger "Alexa Skill Set" Which you get in Trigger Configuration and add Skill Id for Alexa Skills Kit.
-
Now select your Lambda function and select code entry type "Upload a Zip file" and Upload your deployment package.
-
Copy ARN and use this ARN URL as a default endpoint in Alexa skills configuration.
Testing
Now that everything is in place, you can test it on Alexa Test Simulator.
- Go to Alexa Test simulator and invoke your invocation name followed by "alexa ask" like if your invocation name is" loginradius api" then you simply say "alexa ask loginradius api".
- You will get account linking response if your login radius account is not linked with Alexa.
- To test linking feature of LoginRadius Account with Alexa go to Skills and Games Section of Alexa Application and here you will find development skills in "Your Skills" tab, once you find you skill you need to enable it and it will redirect you to loginradius hosted page and after successful login your account is linked with Alexa App .