I'm trying to link an Alexa Skill to a Microsoft App Registration that issues bearer tokens, using the Amazon Account Linking service. And though it lets me log in, and sends a code to Amazon, I'm then getting the classic error: "Unable to link your skill. Please try again later." I think (though I'm not entirely sure) this is the issue.
According to this thread, the state and authentication code need to be in the redirect URL after a #, like https://layla.amazon.com/api/skill/link/{appid}?{any-query-string}#code={token}&state={state}.
However, from Chrome dev tools, Microsoft seems to be handling the code and state in the query string: https://layla.amazon.com/api/skill/link/{appid}?code={code}&state={state}&session_state={session_state}. As a result, the code is not being handled by Amazon, and it never gets as far as requesting a token.
If anyone can confirm this is actually the issue, or has any ideas on how to solve it (ideally without coding up my own whole authorisation API, though I could use some help if that's necessary), do let me know!
For information:
- I'm using the V2 endpoint and auth code grant.
- The Microsoft App registration is working as I can get it to issue tokens to Postman.
- I've used both redirect URLs that Alexa suggests (
https://layla.amazon.com/api/skill/link/{id}andhttps://pitangui.amazon.com/api/skill/link/{id}) though I've tried using them individually just in case, and it didn't help. - Scopes are Calendars.ReadWrite and User.Read, as delegated permissions.
Add your Application ID as the scope in Alexa skill linking setting