tgtg-python icon indicating copy to clipboard operation
tgtg-python copied to clipboard

Cannot authenticate anymore (HTTP 403 Forbidden)

Open ghecko opened this issue 3 years ago • 4 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')

ghecko avatar Oct 14 '22 08:10 ghecko

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

CharlesAttend avatar Oct 14 '22 10:10 CharlesAttend

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 ..

leolehenaff avatar Oct 14 '22 15:10 leolehenaff

Same issue here

gzk-x64 avatar Oct 15 '22 17:10 gzk-x64

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...

gzk-x64 avatar Oct 18 '22 05:10 gzk-x64

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

swiezaczek avatar Oct 25 '22 16:10 swiezaczek

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')

Rx2s1987 avatar Nov 06 '22 15:11 Rx2s1987

The same for me. Error on login stage

swiezaczek avatar Nov 09 '22 11:11 swiezaczek

Looks like having a valid datadome cookie is now mandatory

NitriKx avatar Nov 10 '22 14:11 NitriKx

Looks like having a valid datadome cookie is now mandatory

Is there any bypass for that?

pjamroziak avatar Nov 14 '22 22:11 pjamroziak

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.

swiezaczek avatar Nov 15 '22 11:11 swiezaczek

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

NitriKx avatar Nov 17 '22 20:11 NitriKx

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"?

swiezaczek avatar Nov 18 '22 09:11 swiezaczek

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

Mormaro avatar Nov 18 '22 10:11 Mormaro

It depends on the ip. I noticed residential ip are banned even when sleep time is longer. Mobile ips tend to work with shorter sleep time. In my case 20s. With 15s I get 403 from time to time. I didn'try anything in between yet

swiezaczek avatar Nov 18 '22 19:11 swiezaczek

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.

Rx2s1987 avatar Nov 21 '22 22:11 Rx2s1987

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

NitriKx avatar Nov 22 '22 03:11 NitriKx

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

MichaelShakke avatar Nov 28 '22 11:11 MichaelShakke

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

swiezaczek avatar Nov 30 '22 14:11 swiezaczek

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

BaptisteGarcin avatar Dec 12 '22 19:12 BaptisteGarcin

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

swiezaczek avatar Dec 13 '22 12:12 swiezaczek

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

BaptisteGarcin avatar Dec 13 '22 16:12 BaptisteGarcin

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.

leolehenaff avatar Jan 10 '23 17:01 leolehenaff

where to get them?

wt., 10 sty 2023 o 18:12 leolehenaff @.***> napisał(a):

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.

— Reply to this email directly, view it on GitHub https://github.com/ahivert/tgtg-python/issues/193#issuecomment-1377586412, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HYDZCN7TKEJWFVIK3AWNTWRWJ57ANCNFSM6AAAAAARFA2P3A . You are receiving this because you commented.Message ID: @.***>

swiezaczek avatar Jan 10 '23 21:01 swiezaczek

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.

leolehenaff avatar Jan 19 '23 08:01 leolehenaff

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.

brouckaertd avatar Jan 22 '23 21:01 brouckaertd

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.

https://github.com/ahivert/tgtg-python/issues/205#issuecomment-1399608570

brouckaertd avatar Jan 22 '23 21:01 brouckaertd

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

ahivert avatar Jan 27 '23 13:01 ahivert

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

tjorim avatar Jan 28 '23 23:01 tjorim

I confirm it work now ! Thank you !

ghecko avatar Jan 29 '23 14:01 ghecko