-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix 403 authorization errors #128
base: main
Are you sure you want to change the base?
Conversation
kobodl/kobo.py
Outdated
def get_cookie_value(cookie_name): | ||
if cookie_name in cookie: | ||
return cookie[cookie_name].value | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This closure is never called; did you mean to leave this in here?
e: Looking at this some more, there's some redundant code here; this whole block (529-543) seems like it's a leftover and no longer necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! That definitely shouldn't be in here. I'll delete it
I can confirm that this PR does fix the login issue for me, nice work :) @subdavis apologies for barging in here, I just know from the related issues that you're not affected / able to reproduce this |
@@ -166,7 +184,7 @@ def __GetExtraLoginParameters(self) -> Tuple[str, str, str]: | |||
) | |||
requestVerificationToken = html.unescape(match.group(1)) | |||
|
|||
return koboSignInUrl, workflowId, requestVerificationToken | |||
return koboSignInUrl, workflowId, requestVerificationToken, authCookie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to update the return type for __GetExtraLoginParameters
to Tuple[str, str, str, str]
…_GetExtraLoginParameters function
Please merge this soon. I reseted my account and now I can't add a user or download. Thanks for your work. |
This doesn't seem to fix it for me, but I'm seeing it on the download request.
|
Thanks everyone for your involvement in this fix. I'll get this merged and released later this evening. |
Seems to still get 403 Forbidden on my end sadly |
Hmm, strange. I suppose it could be fixed by replacing that request with |
I’m running it on macOS but I’m on vacation so I’m from weird IP. Maybe it’s IP related and I will try again once I’m back home with residential IP in the U.S. |
Gentoo here, running at home in Scotland on a static IP. I don't think it's the IP though. I know that CloudFlare will block for all sorts of reasons. Lack of a User-Agent string is just one. I suspect urllib could be configured to be acceptable, but it's hard to know exactly what CloudFlare doesn't like about it. |
I've just pushed some commits that introduces a (WIP) request wrapper that revolves around |
Thank you so much for working on this. I tried two ips, my ip on a cruise ship and another ip on azure, both shows 403 forbidden when requesting I feel this is more likely an ip issue with where I am. I will try again next week when I am back. |
and I tried so many VPNs all failed. This is so weird. Again thank you for working on this weird issue |
This works for me! Thanks for your contribution. |
No luck here, although the error is different.
Admittedly I've tweaked it to use Python 3.12, 3.10 is too old for my system, but it did work fine with 3.12 before. |
Seems like |
That did the trick. Many thanks. |
This also happened to me. You also need to add the cloudscrapper patch but this fix works for the login. |
I just want to share that TnS-hun's recent commits fixed the 403 problem for me |
Interestingly enough it doesn't work for me:
Maybe you're using it on an IP address that doesn't get blocked easily by CloudFlare? It used to work weeks before though. |
That's really weird. I think I will just stop here as it's really hard to debug this. Cloudflare is just flaky to bypass and I got my tokens. Thank you! |
Just came back home and with clean ip, everything works with your commits. I guess this was just an ip issue with cloudflare. Thank you! |
sadly, seems nothing works for me now. My home IP, my office IP, etc. all show up with the 403 forbidden for authorize.kobo.com sigh.... |
Probably related: #127
For some reason the authentication process returns 403 errors all of a sudden. I think this is due to CloudFlare blocking the requests automatically. This branch solves it by using
urllib
instead ofrequests
in the specific faulty requests, as pointed out in a StackOverflow post](https://stackoverflow.com/a/74674276).