Add Account Linking Options
Step 3: Configure Redirect URLs to Your App
In this step, you configure your skill to use app-to-app account linking and define the redirect URLs. You can use the Alexa developer console, Alexa Skills Kit Command Line Interface (ASK CLI), or the Account Linking Management REST API to configure your skill. During this step, you specify your app's redirect URL (deep-link enabled), access token URL, and more. For details, see URIs and endpoints.
In this topic, the terms URI and URL are used interchangeably.
Configure URLs in the Alexa developer console
To enable app-to-app account linking using the developer console, take the following steps.
- Sign in to the Alexa Skills Kit developer console.
- On the Skills tab, under SKILL NAME, scroll to find your skill.
- Under ACTIONS, expand the dropdown list in your skill's row, and then select Edit.
- On the left side, click TOOLS, and then click ACCOUNT LINKING.
- Turn on Allow users to link their account to your skill from within your application or website.
- For the authorization grant type, select Auth Code Grant.
App-to-app account linking supports authorization code grant only. - For Your Redirect URLs, add the redirect URLs described in URLs and endpoints / Your app's redirect URLs. Alexa and LWA use these URLs to send the user back to your app.
- For the other settings, use the settings described in Configure Account Linking.
Make sure that you follow these requirements when you add the redirect URLs:
- The redirect URLs must comply with the specified URI syntax. The Alexa app opens this Universal Link or App Link URL to launch your app.
- To handle different scenarios, you can add more than one redirect URL.
- If your app doesn't support Universal Links or App Links, you should have a valid web page that your redirect URLs lead to. The web page should support the same process to receive the user's Amazon authorization code described in How it works.
- Remember to add Your Redirect URLs for your iOS app, Android app, and website.
Configure URLs with the CLI
To enable app-to-app account linking using the ASK CLI, use the update-account-linking-info.
The following example shows the JSON format for the account-linking-request option.
Set the redirectUrls to your fallback URL and the authorizationUrlsByPlatformto your iOS and Android redirect URLs.
For more details about the fields, see Request body properties for Update account linking information REST API.
{
"accountLinkingRequest": {
"type": "AUTH_CODE",
"authorizationUrl": "https://www.amazon.com/ap/oa/",
"clientId": "your.skill.client.id.1",
"scopes": [
"user_id"
],
"accessTokenUrl": "https://api.amazon.com/auth/o2/token",
"accessTokenScheme": "HTTP_BASIC",
"defaultTokenExpirationInSeconds": 20,
"redirectUrls": ["https://www.example.com/ios_redirect", "https://www.example.com/android_redirect"],
"authorizationUrlsByPlatform": [{
"platformType": "iOS",
"platformAuthorizationUrl": "https://your.ios.redirect_url"
},
{
"platformType": "Android",
"platformAuthorizationUrl": "https://your.android.redirect_url"
}
],
"skipOnEnablement": true,
"voiceForwardAccountLinking": "ENABLED"
}
}
Configure URLs with the REST API
To enable app-to-app account linking by using the Account Linking Management REST API, use the following settings for the accountLinkingRequest structure.
| Field | Description | Type |
|---|---|---|
|
|
Set to true to let users enable the skill without starting the account linking flow. Set to false to require the normal account linking flow when users enable the skill. For more details, see Let Users Enable Your Skill without Account Linking. |
Boolean |
|
|
Specifies the OAuth authorization grant type. For app-to-app account linking, you must use |
String |
|
|
Alexa app URL. For more details, see URLs and endpoints. |
String |
|
|
List of additional domains that your log-in page gets content from. You can specify up to 15 domains. |
Array of String |
|
|
Identifier that the Amazon log-in page uses to recognize that the request came from your skill. |
String |
|
|
Strings that indicate the access that you need for the user account, such as the |
Array of String |
|
|
Amazon OAuth URI for requesting authorization tokens |
String |
|
|
Type of authentication used. Set to |
String |
|
|
List of fallback website URLs when your app links aren't available. For more details, see URLs and endpoints. |
Array of String |
|
|
List of URLs by mobile platform used to redirect back to your app. For more details, see URLs and endpoints. |
Array of String |
|
|
Defines the Proof Key for Code Exchange (PKCE) parameters. Include if your app backend supports PKCE using SHA-256.
|
Object |
The following is an example of a request to add redirect URLs by using the Update account linking information operation.
{
"accountLinkingRequest": {
"accessTokenScheme": "HTTP_BASIC",
"accessTokenUrl": "https://api.amazon.com/auth/o2/token/",
"authorizationUrl": "https://www.amazon.com/ap/oa/",
"clientId": "your.skill.client.id.1",
"domains": [],
"redirectUrls": ["yourRedirectURL1","yourRedirectURL2"],
"scopes": ["user_id", "alexa::skills:account_linking"],
"skipOnEnablement": true,
"type": "AUTH_CODE",
"pkceConfiguration": {
"status": "ENABLED",
"codeChallengeMethod": "S256"
}
}
}
Last updated: frontmatter-missing