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):
- In the Alexa app, the user enables the skill.
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
, andscope
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 alwaystoken
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.
The user logs in using their normal credentials for your site.
- Your service authenticates the user and then generates an access token that uniquely identifies the user in your system.
- Your service redirects the user to the specified
redirect_uri
and passes along thestate
,access_token
, andtoken_type
in the URL fragment. - The Alexa service validates the returned information and then saves the
access_token
for the Alexa user. - 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?