2
votes

I am trying to figure out how to link a skill with a custom user account. Here is what the documentation says:

Account linking flow for implicit grant (for use with custom skills):

  1. In the Alexa app, the user enables the skill.
  2. The app displays your login page right within the app, using the Authorization URL you provide when registering your skill on the developer portal. When the companion app calls this URL, it includes state, client_id, response_type, and scope as query string parameters.

    • The state is used by the Alexa service during the account linking process. Your page needs to keep track of this value, as you must pass it back later.
    • The state is used by the Alexa service during the account
    • The client_id is a value defined by you when you set up account linking for the skill in the developer portal.
    • The response_type is always token for the implicit grant flow.
    • The scope is an optional list of access scopes indicating the level of access requested. You define the set of scopes to support when enabling account linking for your skill.
    • The redirect_uri is the URL to which your service redirects the user once the user is authenticated.
  3. The user logs in using their normal credentials for your site.

  4. Your service authenticates the user and then generates an access token that uniquely identifies the user in your system.
  5. Your service redirects the user to the specified redirect_uri and passes along the state, access_token, and token_type in the URL fragment.
  6. The Alexa service validates the returned information and then saves the access_token for the Alexa user.
  7. The user’s Alexa account is now linked to the account in your service, and the skill is ready to be used.

Here is what I get form Amazon:

{
"client_id":"my-client-id",
"response_type":"token",
"state":"some_long_string",
"redirect_uri":"https:\/\/subdomain.amazon.com\/spa\/skill\/account-linking-status.html?vendorId=W5TGH673R
}

Based on what I read above I am redirecting back to:

https://subdomain.amazon.com/spa/skill/account-linking-status.html?vendorId=W5TGH673R&state=same_long_string&access_token=something-I-made-up&token_type=Bearer

Unfortunately this doesn't seem to work. Basically I get: Unable to link your skill

Any ideas?

1

1 Answers

4
votes

I ran into a similar issue, and I had to use a hash instead of an ampersand before the token. My redirect url is:

https://subdomain.amazon.com/spa/skill/account-linking-status.html?vendorId=W5TGH673R#access_token=something-I-made-up&state=same_long_string&token_type=Bearer