ahivert/tgtg-python

Cannot authenticate anymore (HTTP 403 Forbidden)

Closed this issue · 29 comments

Hi,

I cannot authenticate anymore.
Hi,

The following error appends during the client authentication:

Using version 22.9.10
Traceback (most recent call last):
  File "tgtg-alerts.py", line 42, in <module>
    main()
  File "tgtg-alerts.py", line 8, in main
    token = client.get_credentials()
  File "/usr/local/lib/python3.10/dist-packages/tgtg/__init__.py", line 84, in get_credentials
    self.login()
  File "/usr/local/lib/python3.10/dist-packages/tgtg/__init__.py", line 165, in login
    raise TgtgLoginError(response.status_code, response.content)
tgtg.exceptions.TgtgLoginError: (403, b'<html><head><title>apptoogoodtogo.com</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var dd={\'cid\':\'AHrlqAAAAAMA93PIG3AH-zAAVEvhNA==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35587,\'e\':\'0d8230bb1520a6625b31cd5358fadcfecf8c6a16d692d82b7718b705a2dd3945\',\'host\':\'geo.captcha-delivery.com\'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

Yess same issue, I think their updated anti bot things :(

For me it works when I run my script locally but when I run it from an AWS Lambda function, it works sometimes and sometimes I got the same error than you ..

Same issue here

I managed to get the code to work by:

  • turning off all bots for a long time (1 day);
  • renewing the cookie;
  • launching on a single account

It seems to be working again... Will see if it keeps working...

@gaiz-k about what cookie are you talking about? Do you mean tokens?

EDIT: Problem solved! The Problem was my VPN Network which was activated. After deactivated the Script will be works fine!

Running on a Raspberry Pi 2 with Ubuntu Server 20.04

I got the same error today. Same with a new Account, new IP and new system on machine.

python3 login.py Using version 22.10.10 Traceback (most recent call last): File "login.py", line 4, in <module> credentials = client.get_credentials() File "/usr/local/lib/python3.8/dist-packages/tgtg/__init__.py", line 84, in get_credentials self.login() File "/usr/local/lib/python3.8/dist-packages/tgtg/__init__.py", line 165, in login raise TgtgLoginError(response.status_code, response.content) tgtg.exceptions.TgtgLoginError: (403, b'<html><head><title>apptoogoodtogo.com</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var dd={\'cid\':\'AHrlqAAAAAMA0bn-yDiW-J4Aa70eVg==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35587,\'e\':\'ee238cca215333eeb2a1da41651ba55316b0d19c86928c2b8188d4e9ec8cb6d3\',\'host\':\'geo.captcha-delivery.com\'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

The same for me. Error on login stage

Looks like having a valid datadome cookie is now mandatory

Looks like having a valid datadome cookie is now mandatory

Is there any bypass for that?

a valid datadome cookie is now mandatory

I don't think its mandatory. I suppose its only necessary when you're ip/ip range is banned/low score by datadome. Try using mobile provider ip.

I don't think its mandatory. I suppose its only necessary when you're ip/ip range is banned/low score by datadome. Try using mobile provider ip.

Thank you for the tip, I'll have a try from a different location + user country configured

I don't think its mandatory. I suppose its only necessary when you're ip/ip range is banned/low score by datadome. Try using mobile provider ip.

Thank you for the tip, I'll have a try from a different location + user country configured

For me the mobile ip resolves the case. What do you mean by "user country configured"?

in case it helps, I experienced the same, and it seems that they blacklist your public IP
In order to avoid it, I think that the limit for bot detection is around 10 seconds. If you query every 15 seconds it should not blacklist you

Yesterday i got a notification about a available magicbag from my favorites directly over TooGoodToGo App! But this Case was only one time and only fir one of my favs. Later in the day are still other magicbags available, but no directly notification over toogoodtogo app.

From what I've understood, stores can press a button in their UI to notify the people that has their items as favorite

has anyone been able to fix/quick fix the issue? I had the time sleep to 1 minute, until it stopped working, Thanks!

has anyone been able to fix/quick fix the issue? I had the time sleep to 1 minute, until it stopped working, Thanks!

just new ip

I'm getting a 403 even though I refreshed my IP and waited a few days

try new ip along with new account. Is the IP shared with other people or its just for yourself?

I tried a VPN coupled with a proxy and it still didn't work, they must have banned the MAC address, I happened to run my program twice and it made 2 calls every seconds and probably got me banned even though 2/seconds is pretty low.
I booted up an EC2 and it's fine there with 1 call/minute

I finally find something that works. I use rotating mobile proxies that change IP adress every 5 minutes. Since I use that, I do not have problems.

They are a lot of internet websites that propose some rotating mobile proxies, just have a look at them on google and chose the one that fits your needs. However they are not free.

Hi,

I cannot authenticate anymore. Hi,

The following error appends during the client authentication:

Using version 22.9.10
Traceback (most recent call last):
  File "tgtg-alerts.py", line 42, in <module>
    main()
  File "tgtg-alerts.py", line 8, in main
    token = client.get_credentials()
  File "/usr/local/lib/python3.10/dist-packages/tgtg/__init__.py", line 84, in get_credentials
    self.login()
  File "/usr/local/lib/python3.10/dist-packages/tgtg/__init__.py", line 165, in login
    raise TgtgLoginError(response.status_code, response.content)
tgtg.exceptions.TgtgLoginError: (403, b'<html><head><title>apptoogoodtogo.com</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var dd={\'cid\':\'AHrlqAAAAAMA93PIG3AH-zAAVEvhNA==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35587,\'e\':\'0d8230bb1520a6625b31cd5358fadcfecf8c6a16d692d82b7718b705a2dd3945\',\'host\':\'geo.captcha-delivery.com\'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

Make sure your 'access_token' is empty when you are logging in.
When this variable is set, you will send this to the API and will receive an error.

a valid datadome cookie is now mandatory

I don't think its mandatory. I suppose its only necessary when you're ip/ip range is banned/low score by datadome. Try using mobile provider ip.

For some weird reason it is mandatory for me.
The program was running on another location (different IP) until the 403 erro, when I ran it on my pc, I had the same issue.

By adding the cookie to the header, everything works again.

#205 (comment)

New version 0.14.0 have been published on pypi. This one should fix issue encountered here

Great work everyone!
I can confirm it's indeed working as intended (Chouffy/home_assistant_tgtg#48).
This issue can be closed IMHO.

I confirm it work now ! Thank you !