Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to login on amazon.com.au #1101

Closed
flybrys opened this issue Jan 11, 2021 · 21 comments
Closed

Failed to login on amazon.com.au #1101

flybrys opened this issue Jan 11, 2021 · 21 comments

Comments

@flybrys
Copy link

flybrys commented Jan 11, 2021

Describe the bug
Setting up the integration through the UI using either 2FA, 2FA App key, or cookies.txt I receive "Alexa Media Player failed to login."

To Reproduce
Steps to reproduce the behavior:

  1. Go to Configurations > Integrations > Add Integration > Alexa Media Player > Fill out as below:

image

  1. Click on 'Submit'
  2. Confirm OTP if using that method
  3. See error
    image

Expected behavior
For it to integrate as per previous versions

System details

  • Home-assistant (version): 2021.1.0
  • Hassio (Yes/No): Yes
  • alexa_media (version from const.py or HA startup): 3.4.8
  • alexapy (version from pip show alexapy or HA startup): not showing up in logs. 1.20.5
  • Amazon 2FA is enabled (y/n). We will not debug login issues if unanswered: Yes

Logs
Please provide logs. We'll be most likely asking for them anyway.

https://pastebin.com/B0gbBRH7

Additional context
I completely removed from hacs and deleted pickle files and reinstalled - same issue.
Have restarted 2x as per faq

@flybrys
Copy link
Author

flybrys commented Jan 11, 2021

Update: I installed the web terminal in HA and ran pip3 install alexapy and it installs, however when I reboot the system it is no longer found.

Edit: my bad, wasn't executing inside homeassistant docker container.

@flybrys
Copy link
Author

flybrys commented Jan 11, 2021

Update: Rolling back to 3.4.1 works fine

@flybrys flybrys changed the title Failed to login on amazon.com.au / Alexapy not installing Failed to login on amazon.com.au Jan 12, 2021
@alandtse
Copy link
Owner

Can you please enable Advanced Debugging in the sign in screen and generate the logs? It's detecting you've made it to the final login page but when it tests the connection it's being told to relogin.

Please also test the following in a browser. This is what it's doing behind the scenes:

  1. Go to alexa.amazon.com/api/bootstrap. Confirm it redirects you to a sign in page. If it shows you data, you will need to log in and then log out so your browser is logged out.

  2. In your log, look for the url after Attempting oauth login to . It should look like this: https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:323333333733366637373465393236393637663338366633653733663536633723413249564c5635564d32573831&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=en_AU

  3. Try to login using that url.

  4. If successful, you should get:

Looking for Something?We're sorry. The Web address you entered is not a functioning page on our site Go to Amazon.com.au's Home Page

  1. If logging in successfully, try alexa.amazon.com/api/bootstrap and this time you should see some json data. Please confirm you can see this.

@flybrys
Copy link
Author

flybrys commented Jan 12, 2021

Will post advanced debugging logs shortly.

I just did step 1 above in a browser, both in-private and normal, and I get this

We're sorry!
An error occurred when we tried to process your request. Rest assured, we're already working on the problem and expect to resolve it shortly.

No login screen at all

@alandtse
Copy link
Owner

Are you doing .com or .com.au? I see that page at amazon.com.au/api/bootstrap. It should be .com.

@flybrys
Copy link
Author

flybrys commented Jan 12, 2021

Are you doing .com or .com.au? I see that page at amazon.com.au/api/bootstrap. It should be .com.

Same message on both .com and .com.au

@alandtse
Copy link
Owner

Can you please confirm you're using https? I switched to https://alexa.amazon.com.au/api/bootstrap and now I don't see the error.

@flybrys
Copy link
Author

flybrys commented Jan 12, 2021

That works now, returns some JSON data with my name etc.

I have the get and post logs from advanced debugging, are they safe to post here?

@alandtse
Copy link
Owner

I don't need the get/post pages. I do need the expanded log output though. Please do a scrub before you post on pastebin. You may need to truncate the cookie values but leave intact the names.

Since you can login to the bootstrap site, please follow the steps and report back whether it works after using the signin link from your logs.

@flybrys
Copy link
Author

flybrys commented Jan 12, 2021

Using the signin link from the log works, however it does ask me for a captcha as well as my OTP despite having 2FA enabled
After going back to https://alexa.amazon.com.au/api/bootstrap it takes me back to another sign in screen

Advanced Debug log
https://pastebin.com/GKgT1NDF

@alandtse
Copy link
Owner

Sorry, use https://alexa.amazon.com/api/bootstrap. That is the site that has to work.

@flybrys
Copy link
Author

flybrys commented Jan 12, 2021

Sorry, use https://alexa.amazon.com/api/bootstrap. That is the site that has to work.

Step 1 takes me to sign in page. Didn't sign in and went to step 2.
Step 2 asks me to log in
Step 3 I log in and when entering password it takes me back and asks for a captcha. Providing this correctly takes me to the OTP page and I enter in the code.
Step 4 I get the expected message
Step 5 I get presented with another logon screen.

@LintHart
Copy link

@brywithawhy, following as I seem to be running into the same problem as you with my Australian account. 5 Steps above are successful for me but I'm still getting a failed login. "Login failed; check credentials" and "If credentials correct, please report these missing values: ['encryptedPasswordExpected']" at the end of my log.

It used to work just fine until recently, though I could never get the built in 2FA to work. I've also tried rolling back a few versions to no avail. Currently on the latest v3.4.8

I'll post my own issue if you get it working with further help from @alandtse and I dont :)

@alandtse
Copy link
Owner

I'm not sure why your accounts have this issue. I'm able to login to amazon.com.au from two of my accounts (both US based however). I'll likely provide a legacy option so you can use the old method to login. However, you won't have access to the oauth benefits which means you'll have to relogin whenever Amazon decides to make you.

@flybrys
Copy link
Author

flybrys commented Jan 13, 2021

I've rolled back to 3.4.1 and the 2fa key option works fine

@alandtse
Copy link
Owner

It used to work just fine until recently, though I could never get the built in 2FA to work. I've also tried rolling back a few versions to no avail. Currently on the latest v3.4.8

Try 3.4.1 as that has the old login method. The issues @brywithawhy is reporting only exist in 3.4.2 and above when I switched to the oauth token login the app uses. The five steps I asked about are what the component is doing in the background. The fact that step 5 shows another login is why it's failing.

@flybrys
Copy link
Author

flybrys commented Jan 14, 2021

Thanks anyway for trying @alandtse
If there's anything else I can do to try and get it working in the future let me know, I'd love more than anything to never have to log in again

@wizy69
Copy link

wizy69 commented Jan 15, 2021

Can you please enable Advanced Debugging in the sign in screen and generate the logs? It's detecting you've made it to the final login page but when it tests the connection it's being told to relogin.

Please also test the following in a browser. This is what it's doing behind the scenes:

  1. Go to alexa.amazon.com/api/bootstrap. Confirm it redirects you to a sign in page. If it shows you data, you will need to log in and then log out so your browser is logged out.
  2. In your log, look for the url after Attempting oauth login to . It should look like this: https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:323333333733366637373465393236393637663338366633653733663536633723413249564c5635564d32573831&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=en_AU
  3. Try to login using that url.
  4. If successful, you should get:

Looking for Something?We're sorry. The Web address you entered is not a functioning page on our site Go to Amazon.com.au's Home Page

  1. If logging in successfully, try alexa.amazon.com/api/bootstrap and this time you should see some json data. Please confirm you can see this.

Hi, similar issue, was able to successfully complete these steps. Yet integration still says login failed. Have tried both the amazon region domain as amazon.com and amazon.com.au

@EddyYama
Copy link

I've got the same error "Alexa Media Player failed to login." since about a couple of weeks ago. It used to work fine until then. 2FA is enabled.
I've tried dozens of times of logins, but still have the same login fail message.
I think the difference from @brywithawhy case is Amazon region domain is amazon.co.jp in my case.
I've tried rolling back to 3.4.1 and 3.4.0, but still no luck...

@alandtse
Copy link
Owner

@brywithawhy 3.5.0 has the fallback option for oauth token method. Disable that checkbox at the bottom and you will get the 3.4.1 login method. Let me know if you're still having issues with logging in.
image

@Myskat
Copy link

Myskat commented Dec 30, 2021

Hello, can you indicate the source, where did you get the information on the constructor of this URL? In particular, I can't figure out where..signin comes from? .. Found either ..oauth2 .. in Cognito, or ..oa? .. in LWA. I also can't find info on ... client_id = device: 4145 ... Found either ..client_id = amzn1.application-oa2-client.b4d6 .. in LWA, or ..opn6m304vbavurl9 .. in Cognito.
Thank you in advance!
Hello, can you indicate the source, where did you get the information on the constructor of this URL? In particular, I can't figure out where..signin comes from? .. Found either ..oauth2 .. in Cognito, or ..oa? .. in LWA. I also can't find info on ... client_id = device: 4145 ... Found either ..client_id = amzn1.application-oa2-client.b4d6 .. in LWA, or ..opn6m304vbavurl9 .. in Cognito.
Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants