Alexa Account Linking with Auth0
Account Linking lets your Alexa Skill identify who the user is by connecting their Amazon account to your own authentication system. In this guide, we'll use Auth0 as the OAuth 2.0 provider and the Jovo Framework to handle the integration.
Why Account Linking?
Without Account Linking, every Alexa session is anonymous. You can't save user preferences, access their data, or provide personalized responses. Account Linking bridges that gap by letting users sign in with their existing credentials (Google, email/password, social logins) through a secure OAuth 2.0 flow.
Common use cases: personalized content delivery, subscription services, e-commerce order tracking, fitness data access, and smart home device pairing.
Prerequisites
- A working Jovo Alexa Skill
- An Auth0 account (free tier works)
- Basic understanding of OAuth 2.0
Step 1: Configure Auth0
Create a new application in your Auth0 dashboard:
- Go to Applications โ Create Application
- Choose Regular Web Application
- In the Settings tab, add the Alexa redirect URLs:
https://layla.amazon.com/api/skill/link/M1234567890
https://pitangui.amazon.com/api/skill/link/M1234567890
- Note your Client ID, Client Secret, and Domain
Step 2: Configure the Alexa Skill
In your jovo.project.ts, add the account linking configuration to the Alexa platform plugin:
// jovo.project.ts
alexa: {
accountLinking: {
type: 'AUTH_CODE',
authorizationUrl: 'https://YOUR_DOMAIN.auth0.com/authorize',
accessTokenUrl: 'https://YOUR_DOMAIN.auth0.com/oauth/token',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
scopes: ['openid', 'profile', 'email']
}
}
Step 3: Access User Data in Handlers
Once a user links their account, you can access their Auth0 profile through the access token in your Jovo handlers:
async LAUNCH() {
const accessToken = this.$request.getAccessToken();
if (!accessToken) {
return this.$send({
message: 'Please link your account in the Alexa app.',
platforms: { alexa: { card: { type: 'LinkAccount' } } }
});
}
// Fetch user profile from Auth0
const user = await getUserProfile(accessToken);
return this.$send({
message: `Welcome back, ${user.name}!`
});
}