In order to set up your Salesforce Connected App, you need your Amazon Developer Account Linking Redirect URLs. This is specific to your Amazon Developer account. You do not need to save any settings on this page at this time.
- Go to
https://developer.amazon.com/alexa/console/ask/<Skill ID>/development/en_US/account-linking
. - Move the slider to the right of the question "Do you allow users to create an account or link to an existing account with you?" to the right to enable account linking.
- Copy and store the three URLs that show next to Redirect URLs at the bottom of the page. They will look like this:
https://alexa.amazon.co.jp/api/skill/link/<Vendor ID>
https://layla.amazon.com/api/skill/link/<Vendor ID>
https://pitangui.amazon.com/api/skill/link/<Vendor ID>
- Launch your Trailhead Playground org and click the Setup icon in the top right, then select the Setup link.
- Enter App Manager into the Quick Find box and then select App Manager.
- Click New Connected App.
- In the New Connected App form, fill in:
- Basic Information:
- Connected App Name: Alexa Skill
- API Name: Alexa_Skill
- Contact Email: enter your email address
- API (Enable OAuth Settings):
- Check Enable OAuth Settings.
- For Callback URL, use the Redirect URLs from the previous step.
- In Selected OAuth Scopes, select Access and manage your data (api).
- Click Add.
- In Selected OAuth Scopes, select Perform requests on your behalf at any time (refresh_token, offline_access).
- Click Add.
- Click Save.
- Click Continue.
- Click App Manager again. Locate your newly created Alexa Skill and click the dropdown arrow on the far right. Select View.
- Copy and store the Consumer Key and the Consumer Secret (click the Click to reveal button to see the secret key). You will need this shortly.
With the details set in your Trailhead Playground Org, we can set up account linking with the Alexa skill we created earlier.
- Go back to the ASK CLI. Enter the following command and fill out the resulting entries using your Connected App settings:
$ ask api create-account-linking -s <Skill ID>
? Authorization URL: https://login.salesforce.com/services/oauth2/authorize
? Client ID: <Your Client ID>
? Scopes(separate by comma): api,refresh_token
? Domains(separate by comma):
? Authorization Grant Type: AUTH_CODE
? Access Token URI: https://login.salesforce.com/services/oauth2/token
? Client Secret: [hidden] <Your Client Secret>
? Client Authentication Scheme: REQUEST_BODY_CREDENTIALS
? Optional* Default Access Token Expiration Time In Seconds: 3600
Account Linking created successfully.
- The Default Access Token Expiration Time In Seconds field is required for Salesforce account linking. If you notice that you need to constantly re-link your Salesforce account to use the skill, re-do the previous step.