core: Alexa skill account linking - invalid redirect URI
The problem
I followed all the steps in “Amazon Alexa Smart Home Skill” (Amazon Alexa Smart Home Skill - Home Assistant 3), but when I try to link my Home Assistant account to my Alexa Skill in my Android Alexa app, after logging in to Home Assistant with my CORRECT username and password I get the following message: “Error: Invalid redirect URI”. The same thing happens when I try it on my Kindle Fire Alexa app.
My Home Assistant log shows the following message after trying this:
Login attempt or request with invalid authentication from netbox (10.0.0.138). Requested URL: ‘/auth/login_flow/ab2e8de69fe2f8b99812de92d8ea6310’. (Mozilla/5.0 (Linux; Android 12; SAMSUNG SM-G990E) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/19.0 Chrome/102.0.5005.125 Mobile Safari/537.36)
(The hexadecimal in the URL after login_flow is different on every attempt).
I did NOT enable the “Allow users to link their account to your skill from within your application or website” option because the documentation says that “This will require a Redirect URI, which won’t work”, but still I get the above error. I also tried to enable this option and provide the redirect URI specified at the bottom of the account linking page according to my region - same result.
The documentation page mentions that the linking can also be done by using the Alexa Web-based app, but I couldn’t find any mention of skills on the Web app.
My HA installation is accessible from the outside using HTTPS at port 443 (I forwarded it to 8123 in my router).
What version of Home Assistant Core has the issue?
2023.1.1 (Also on previous versions)
What was the last working version of Home Assistant Core?
None
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Amazon Alexa
Link to integration documentation on our website
https://www.home-assistant.io/integrations/alexa.smart_home/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Login attempt or request with invalid authentication from netbox (10.0.0.138). Requested URL: '/auth/login_flow/ab2e8de69fe2f8b99812de92d8ea6310'. (Mozilla/5.0 (Linux; Android 12; SAMSUNG SM-G990E) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/19.0 Chrome/102.0.5005.125 Mobile Safari/537.36)
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 32 (5 by maintainers)
Found the solution: basically, Alexa will always assume the default language of your Alexa account to decide the server to use. Follow the follwing steps:
In summary, you should use your Alexa app language and not your location to follow the process.
Found a clean solution.
Login to home assistant. No need to change anything in AWS or Alexa account
Ok, got it working…
Make sure the server you choose there is the same as you chose for your “client” id. Eu/US etc.
I simply changed my client ID to the US , as its 1 am and CBA to go through the list of eu data centers to find a Alexa compatible EU data center.
So my client id was: layla.amazon. … changed it to pitangui.amazon as that is US, (same as where my function lives), and working now
one can see the function location by the function ARN host name.