Linked Profile (Account Linking) Sample Skill
This sample custom skill demonstrates account linking for the purposes of utilizing a linked profile. While any compliant oAuth identity provider could be used with account linking, Amazon Cognito will be used in this sample.
These instructions will cover how to setup a user account and oAuth service using Amazon Cognito User Pools, coupled with an example skill (written using the Alexa Skills Kit SDJ for Node.js) that links to the Cognito OAuth service and provides personalized responses.
This sample may provide a starting point for skill developers who need but do not have existing user account or OAuth infrastructure. If the Cognito feature of additional user attributes/properties is not required, consider using Login with Amazon or other identity providers.
NOTE: This sample does not constitute a full solution for user account management and OAUTH, nor does it provide functionality as-is which would be suitable for publishing to the Alexa Skill store.
In order to completely setup this sample, the following are required:
- AWS account which can:
- Create Amazon Cognito User Pools
- Create AWS IAM roles
- Create AWS Lambda functions
- Amazon Developer account
- Your developer account's Vendor Id. To lookup your Vendor ID, go to https://developer.amazon.com/settings/console/mycid and sign in with your Amazon Developer account if prompted. Once you have it, copy it to your Scratch-Pad.
What's a Scratch-Pad? In addition to your Vendor Id, there will be a number of values you will obtain from one step and then need to use at a later time. We recommend creating a new text file using your favorite text editor to use as a "scratch pad". We will refer to this text file as the Scratch-Pad. TODO: decide if a template for the scratch pad is worthwhile.
- (Optional) Domain, optionally hosted in Amazon Route53
Note: if you will be creating a linked skill for testing or demo purposes only, access to a domain is not required. If you are creating something for production use, you will need the ability to create a domain name that can be used by Amazon Cognito.
- (Optional) Alexa Skills Kit (ASK) Command-Line Interface (CLI)
Using the ASK CLI is optional. Both GUI and CLI based instructions are provided. If you'd like to setup the ASK CLI click here for a quick start to set it up on your machine. As an alternative, you can setup the ASK CLI on an AWS Cloud9 instance in ~5 minutes with instructions found here. To learn more about Cloud9, click here.
- (Optional) AWS CLI setup
Like the ASK CLI, using the AWS CLI is optional. Both GUI and CLI based instructions are provided. If you'd like to setup the AWS CLI click here and follow the instructions appropriate to your operating system. If you opted to use CLoud9 for setting up the ASK CLI, the AWS CLI is installed by default on your Cloud9 instance.
During this walk through you will setup the following:
- Amazon Cognito User Pool w/custom attributes
- AWS IAM role to allow the AWS Lambda function to access Amazon Cognito
- Alexa Skill configured with Account Linking
- AWS Lambda function to power your skill
- A test account in your User Pool
To get started by creating the Amazon Cognito User Pool, click here.
This library is licensed under the Amazon Software License.