Apollon77 / alexa-cookie

Library to generate a cookie including a csrf for alexa remote
MIT License
36 stars 13 forks source link

On login, when the sms token is asked, page keeps refreshing and it is not possible to type the code #137

Closed beothorn closed 1 month ago

beothorn commented 1 month ago

Describe the bug
When it is the first login, Amazon redirects to a page with an input for a number sent to the phone number of the user.
The page keeps refreshing, and on every refresh, the number is cleared.

I can see that there is a form <form id="pollingForm" method="get" action="/ap/cvf/approval/poll"> and the ajax call for /ap/cvf/approval/poll returns a 302 response with redirection to http://localhost:3000/www.amazon.com/404

Without the proxy, the poll returns 200 OK

Eventually it tries to get www.amazon.com/404 , which returns a 404.

Then, this is triggered:

function handlePollingError() {
    window.location.reload();
}

I am investigating and may come up with a solution.
I am getting it from alexa-remote, but I`ve seen it before also on node-red.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the proxy page to login in a machine never logged before, with an account with 2FA enabled
  2. Type user password
  3. Start typing the token from the sms, before finishing it will reload if you are not fast enough

Expected behavior
Do not refresh, token works when login is clicked.

Screenshots & Logfiles
image

Versions:
Latest alexa-remote2

Additional context

Maybe a misconfiguration? I am looking into it.

Apollon77 commented 1 month ago

see https://github.com/Apollon77/alexa-cookie?tab=readme-ov-file#troubleshooting-for-getting-the-cookie-and-tokens-initially ... change your OTP mechanism to the current one