athrowaway2021 / comix

Seamlessly download and de-drm comics and manga from Kindle in highest possible quality
MIT License
61 stars 20 forks source link

API error when trying to auth. #23

Closed Wisperer closed 2 years ago

Wisperer commented 2 years ago
{"response": {"challenge": {"challenge_reason": "AuthenticationFailed", "uri": "https://www.amazon.com/ap/challenge?arb=14c7afd4-2ad6-4249-8564-cb60fb081415", "required_authentication_method": "GenericClaimPassword"}}, "request_id": "0825dd8f55734e85b7f3a0d7af1a62c2"}
Traceback (most recent call last):
  File "/home/fletcher/comix/comix.py", line 142, in <module>
    cmx = Cmx(None)
  File "/home/fletcher/comix/comix.py", line 23, in __init__
    self.auth_token = amazon_api.login(config.EMAIL, config.PASSWORD)["access_token"]
TypeError: 'NoneType' object is not subscriptable

Known good password and email. Works fine with an older version of the script.

Ran with `python comix.py list' after adding account info to config.py

WorkingJB commented 2 years ago

I suspect this is due to the site shifting from comixology to read.kindle.com, and the headers still referencing comixology.comics.

KaHooli commented 2 years ago

I'm running this on a brand new install of Ubunutu 22.04 LTS with only the following have been run...

sudo apt update; sudo apt dist-upgrade; sudo apt upgrade; sudo apt autoremove
sudo apt install vim git python3-pip
git clone https://github.com/athrowaway2021/comix
cd comix
pip install -r requirements.txt

I then added my details to config.py and tried to run the script. I found I needed to run pip install xmltodict to get the script to run. I then tried again and got the same message as OP.

Getting auth token . . .
{"response": {"challenge": {"challenge_reason": "HandleOnWebView", "uri": "https://www.amazon.com/ap/challenge?arb=<removed>"}}, "request_id": "<removed>"}
Traceback (most recent call last):
  File "/home/james/comix/comix.py", line 142, in <module>
    cmx = Cmx(None)
  File "/home/james/comix/comix.py", line 23, in __init__
    self.auth_token = amazon_api.login(config.EMAIL, config.PASSWORD)["access_token"]
TypeError: 'NoneType' object is not subscriptable
comment-account commented 2 years ago

Try going to Amazon.com in your web browser, logging out of your account, and then logging back on again. I think this following line is the clue:

{"response": {"challenge": {"challenge_reason": "HandleOnWebView", "uri": "https://www.amazon.com/ap/challenge?arb="}}, "request_id": ""}

What happened for me is that I needed to respond to a prompt that it is actually me trying to login. You can't get at that prompt using the script, but it appears reconfirming in the web browser that you are you is enough so that it stops happening in the script. I generally use Linux but loaded the script in Windows and I ran into this exact situation. Once I confirmed things in the browser, the script worked fine.

athrowaway2021 commented 2 years ago

The above reply is correct, 3309195bd433f911dd2b10b76120875a966a3eb1 adds a message that tells users with 2FA to relogin in browser if this issue occurs.