Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Latest commit

 

History

History
62 lines (50 loc) · 4.35 KB

4-account-linking.md

File metadata and controls

62 lines (50 loc) · 4.35 KB

Alexa Skill Sample - Sales Assistant

Salesforce SetupDeployAccount LinkingTestingDistribute Private SkillsDistribute Private Skills

Part 4: Account Linking

Obtain Your Amazon Developer Account Linking Redirect URLs

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.

  1. Go to https://developer.amazon.com/alexa/console/ask/<Skill ID>/development/en_US/account-linking.
  2. 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.
  3. 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>
  1. You do not need to do anything else on this page.

Create a Connected App in Salesforce

  1. Launch your Trailhead Playground org and click the Setup icon in the top right, then select the Setup link.
  2. Enter App Manager into the Quick Find box and then select App Manager.
  3. Click New Connected App.
  4. 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.
  1. Click App Manager again. Locate your newly created Alexa Skill and click the dropdown arrow on the far right. Select View.
  2. 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.

Update Your Skill to Link to Your Salesforce Org

With the details set in your Trailhead Playground Org, we can set up account linking with the Alexa skill we created earlier.

  1. We will use the ASK CLI to accomplish this. 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.
  1. 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.

Next