Alexa Account Linking starting from your app (Optional)
Introduction
This account linking flow enables users to link their Alexa user account with their account in another service by starting from your app. When you start the account linking flow from the app, users can:
- Discover your Alexa skill through your app.
- Initiate skill enablement and account linking from within the app.
- Link their account without entering Alexa account credentials if already logged into Alexa app. They will have to login to their app service once when trying to link accounts.
- Link their account from your app using Login with Amazon (LWA), when the Alexa app isn't installed on their mobile device.
Note: The developer documentation for the app to app linking starting from mobile app can be found here.
Pre-requisites
Integration of Alexa with ESP RainMaker should be completed. The detailed steps are given in the section Voice Assistant Integration.
If not done, please follow the "Voice Assistant Integration" steps and come back here to enable App to App Account linking.
ESP-RainMaker-3P-Integration-AddOns repo should be deployed.
If the repo is not deployed already, please follow the steps given in the section: Deploying Voice Assistant Integrations AddOns repo
Following are the steps to configure Alexa App to App account linking:
Creating redirection URL for mobile apps
Users are redirected to your app after they acknowledge the linking request in the Alexa app or LWA. For this redirection to happen, it is required to create Universal Link for iOS app and App Link for Android app.
Following are the steps to host the files for Universal link and App link in AWS S3 [Note: Please ensure that your user has admin privileges before moving onto the next steps]:
Creating S3 bucket
Go to AWS Console -> Services -> S3
Click on "Create bucket".
Add the name for the bucket.
Select the region to create the bucket in.
Scroll down to "Object Ownership" settings and select the "ACLs enabled" option
Scroll down to "Block Public Access settings for this bucket" settings.
Untick the option "Block all public access", and accept the acknowledgment. Note that this step is mandatory for linking process.
Scroll to the end of the page and select "Create Bucket".
From the list of the buckets, click on the newly created bucket.
Click on "Create Folder" and create .well-known folder.
Tick the small box in front of the .well-known folder and click on the "Copy URL" option.
Remove the ".well-known/" suffix from the URL noted in step 10. Note this value, as it will be required in further steps. Let's call this value redirectURL.
To create the App Link (Android) or Universal Link (iOS) refer to the steps given in the following:
Uploading the files to S3 with public read access
Go to AWS Console -> Services -> S3.
From the list of the buckets, click on the newly created bucket.
Go to .well-known folder.
Upload the files in .well-known folder in S3 bucket:
For Android App Link, upload the assetslinks.json file, created in the previous section.
For iOS Universal Link, upload the apple-app-site-association file, created in the previous section.
Note that if you want to upload files for both iOS and android, steps 5-10 need to be done for both files.
- Scroll down and expand the "Permissions" section.
- Select the "Grant public-read access" option.
- Accept the acknowledgment.
- Click on Permissions tab. You need add below bucket policy by changing the bucket name & save changes.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket-name/*"
}
]
}
- Click on the "Upload" button at the end of the page.
Configuring callback URL in RainMaker
Login to RainMaker dashboard with admin credentials.
Go to the Deployment Settings tab.
Click on "Cognito Configurations".
Look for Cognito app client with client name "esp-rainmaker-alexa-skill".
Update callback URLs for "esp-rainmaker-alexa-skill" client. Add the redirectURL value copied in step 12 of the "Creating S3 bucket" section, to the existing callback URLs.
Note that the two URLs should be separated by a comma(,).
Enabling App to App account linking for Alexa skill
Login to Alexa Developer Console.
From the list of the skills, select the skills that you want to configure for app to app linking.
Click on the Account Linking tab on the left navigation bar.
- Enable the option "Allow users to link their account to your skill from within your application or website"
Scroll down to "Your Redirect URLs" setting.
Click on the "+" sign to add the redirect URL.
Enter the redirectURL value copied in step 12 of the "Creating S3 bucket" section.
- Add client secret for "esp-rainmaker-alexa-skill" app client. You can find the steps to get client id and client secret for "esp-rainmaker-alexa-skill" app client here- Getting client ID and client secret
- Save the changes.
Getting the value of Alexa Access token URL
Make sure you are in the same AWS region where you have deployed RainMaker.
Login to AWS console and go to API Gateway Service.
Look for API Gateway "AlexaSkillLinking AWS Api Gateway".
- Go to "stages" tab.
Expand the dev stage.
Click on POST method.
Copy the Invoke URL. This URL will be required while configuring "alexaAccessTokenURL" for mobile apps.
After the above configuration steps are completed, please configure Alexa account linking for mobile apps.
Steps for Alexa account linking configuration for iOS and Android apps: