Skip to content
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

Ability to personalize coordinates #248

Closed
wants to merge 1 commit into from
Closed

Ability to personalize coordinates #248

wants to merge 1 commit into from

Conversation

li7vinov-denis
Copy link

  • added ability to personalize desired coordinates, which allows to escape captcha

@zig284
Copy link

zig284 commented Jan 7, 2024

Just tested but didn't change anythings for me.
It's installed on a RPi using my home IP.

@TP8609
Copy link
Contributor

TP8609 commented Jan 7, 2024

I got the same i got it running on a NUC can't change my ip adres. The app is working normal on the same ip adres

@li7vinov-denis
Copy link
Author

Did you changed coordinates in configuration using -config command?

@zig284
Copy link

zig284 commented Jan 7, 2024

I double check the changes I made from your pull but still have this error...

Saved config at: /home/data/tgtg-bot/.config/toogoodtogo-watcher-nodejs/config.json
node:events:495
throw er; // Unhandled 'error' event
^

Error: spawn vim ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
at onErrorNT (node:internal/child_process:477:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:290:12)
at onErrorNT (node:internal/child_process:477:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn vim',
path: 'vim',
spawnargs: [
'/home/data/tgtg-bot/.config/toogoodtogo-watcher-nodejs/config.json'
]
}

Node.js v18.19.0

@TP8609
Copy link
Contributor

TP8609 commented Jan 7, 2024

Did you changed coordinates in configuration using -config command?

I just changed it in the config file as i have the same error as zig
I had VIM not installed that was the problem. But i changed it according to your changes yes.

@c0lumb0
Copy link

c0lumb0 commented Jan 8, 2024

Do the changes work for someone?

@zig284
Copy link

zig284 commented Jan 8, 2024

No change for me !

@ubergesundheit
Copy link

@li7vinov-denis do you have a docker image with these changes published somewhere?

@Dermayer
Copy link

I can't get it to work anymore either.

@luccalb
Copy link

luccalb commented Jan 10, 2024

Problem is that all of your sessions have probably expired, and the captcha cannot be avoided by sending the coordinates when logging back in. You'll have to log in using the app e.g. through an emulator, then copy access/refresh tokens and datadome cookie into the config manually. Then it should work.

@ubergesundheit
Copy link

Tried to re-auth with the code in the PR but it seems the captcha is still being triggered. I'm still getting a 403 response

Something went wrong: HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (file:///home/node/app/node_modules/got/dist/source/as-promise/index.js:86:42)
    at Object.onceWrapper (node:events:632:26)
    at Request.emit (node:events:529:35)
    at Request._onResponseBase (file:///home/node/app/node_modules/got/dist/source/core/index.js:726:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Request._onResponse (file:///home/node/app/node_modules/got/dist/source/core/index.js:765:13)
....

@c0lumb0
Copy link

c0lumb0 commented Jan 11, 2024

Problem is that all of your sessions have probably expired, and the captcha cannot be avoided by sending the coordinates when logging back in. You'll have to log in using the app e.g. through an emulator, then copy access/refresh tokens and datadome cookie into the config manually. Then it should work.

I'm not sure this is the long term solution.
Before updating to latest version of this application, I just did that, since the datadome cookie I got from solving the captcha or just opening

https://apptoogoodtogo.com/api/auth/v3/token/refresh

has a max. validity and basically expired every couple of days. After the update this was not necessary anymore.

@zig284
Copy link

zig284 commented Jan 11, 2024

Where do you put the datadome in config files ?

Weird things is that login is working using a tgtg-python script. And trigger the (old one??) email link/digit code verification process.

EDIT : Python script not working from now... Asking for captcha code

@c0lumb0
Copy link

c0lumb0 commented Jan 11, 2024

Where do you put the datadome in config files ?

Weird things is that login is working using a tgtg-python script. And trigger the (old one??) email link/digit code verification process.

This is described here

#201 (comment)

how the datadome cookie was added manually before the latest update to the application, which should have made this redundant.

@zig284
Copy link

zig284 commented Jan 11, 2024

Ok thanks for the link :)
Used this https://github.com/marklagendijk/node-toogoodtogo-watcher/issues/231#issue-1668501045 to get my cookie datadome and it's working well now !

@c0lumb0
Copy link

c0lumb0 commented Jan 11, 2024

Ok thanks for the link :) Used this https://github.com/marklagendijk/node-toogoodtogo-watcher/issues/231#issue-1668501045 to get my cookie datadome and it's working well now !

Ok, then I will do the same.
Please keep us updated, how long the cookie is valid or if it expires at all.

@NickXDD
Copy link

NickXDD commented Jan 11, 2024

For me opening the https://apptoogoodtogo.com/api/auth/v3/token/refresh website doesn't show any captcha to solve (shows text with 405 GET error, which shouldn't be any problem). I can still get my cookie datadome however, but after adding to the config file there's still the 403 error. Can't login in the tgtg watcher too due to the same error

@zig284
Copy link

zig284 commented Jan 11, 2024

Even from another web browser ? Or try clean you web browser cookies/sessions.
Also try emptying the "session" section
"session": { },
Then try to login.

@c0lumb0
Copy link

c0lumb0 commented Jan 11, 2024

For me opening the https://apptoogoodtogo.com/api/auth/v3/token/refresh website doesn't show any captcha to solve (shows text with 405 GET error, which shouldn't be any problem). I can still get my cookie datadome however, but after adding to the config file there's still the 403 error. Can't login in the tgtg watcher too due to the same error

Same here.
Started off greenfield and getting the 403 even at log in stage, so that an email is not sent.

EDIT:
It's not an IP related issue btw, since I tried starting off fresh with a different IP as well.

@NickXDD
Copy link

NickXDD commented Jan 11, 2024

Even from another web browser ? Or try clean you web browser cookies/sessions. Also try emptying the "session" section "session": { }, Then try to login.

Already tried all of that, still the same issue

@NickXDD
Copy link

NickXDD commented Jan 11, 2024

Ok, got it working miraculously. In the config beside "cookie" I've also put "user-agent" like this:

"headers": {
"User-Agent": "TooGoodToGo/23.12.1 (550) (iPhone/iPhone 11 (GSM); iOS 16.3.1; Scale/2.00)",
"Cookie": ""
}

Put your datadome after the cookie. What I've done to make it work is that I changed the app version in the "user-agent" to the latest one, which is 23.12.1 and it started working.

@c0lumb0
Copy link

c0lumb0 commented Jan 11, 2024

Ok, got it working miraculously. In the config beside "cookie" I've also put "user-agent" like this:

"headers": { "User-Agent": "TooGoodToGo/23.12.1 (550) (iPhone/iPhone 11 (GSM); iOS 16.3.1; Scale/2.00)", "Cookie": "" }

Put your datadome after the cookie. What I've done to make it work is that I changed the app version in the "user-agent" to the latest one, which is 23.12.1 and it started working.

Yup, that did it also for me. Log-in and watching works!
I started from scratch with reinstalling Node as well as the application itsself.
Thanks! :)

I hope that the cookie is not expiring any time soon.

@TP8609
Copy link
Contributor

TP8609 commented Jan 11, 2024

Thank you its working again

@KenzoKenzo94
Copy link

am not able to retrieve the datadome anymore from https://apptoogoodtogo.com/api/auth/v3/token/refresh

I just get: {"type":"about:blank","title":"Method Not Allowed","status":405,"detail":"Method 'GET' is not supported.","instance":"/api/auth/v3/token/refresh"} and when I go to the network tab in the dev tools I just see this:

image

Any idea on what could be wrong?

@c0lumb0
Copy link

c0lumb0 commented Jan 12, 2024

am not able to retrieve the datadome anymore from https://apptoogoodtogo.com/api/auth/v3/token/refresh

I just get: {"type":"about:blank","title":"Method Not Allowed","status":405,"detail":"Method 'GET' is not supported.","instance":"/api/auth/v3/token/refresh"} and when I go to the network tab in the dev tools I just see this:
image

Any idea on what could be wrong?

The refresh doc with the error code 403 should have the information regarding the cookie, at least that's where I got it from. That GET is not allowed anymore as method is new, but nevertheless you get a cookie, so it doesn't matter in the end.

@laurentdu56
Copy link

thanks it work for me.

:)

@fenooooo
Copy link

I tried to apply NickXDD's solution but after trying everything I can't do it. could someone help me?

@c0lumb0
Copy link

c0lumb0 commented Jan 24, 2024

I tried to apply NickXDD's solution but after trying everything I can't do it. could someone help me?

What kind of errors do you get?

@fenooooo
Copy link

I tried to apply NickXDD's solution but after trying everything I can't do it. could someone help me?

What kind of errors do you get?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

@c0lumb0
Copy link

c0lumb0 commented Jan 25, 2024

I tried to apply NickXDD's solution but after trying everything I can't do it. could someone help me?

What kind of errors do you get?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Hm...hard to say tbh.
I would start completely from scratch and then apply the changes mentioned here.
That's how I got it start working.

@KenzoKenzo94
Copy link

am not able to retrieve the datadome anymore from https://apptoogoodtogo.com/api/auth/v3/token/refresh
I just get: {"type":"about:blank","title":"Method Not Allowed","status":405,"detail":"Method 'GET' is not supported.","instance":"/api/auth/v3/token/refresh"} and when I go to the network tab in the dev tools I just see this:
image
Any idea on what could be wrong?

The refresh doc with the error code 403 should have the information regarding the cookie, at least that's where I got it from. That GET is not allowed anymore as method is new, but nevertheless you get a cookie, so it doesn't matter in the end.

Hmm not sure I get it. Before I just had to copy the value from the datadome field and it was working. Now there is no datadome field at all.

@c0lumb0
Copy link

c0lumb0 commented Jan 25, 2024

am not able to retrieve the datadome anymore from https://apptoogoodtogo.com/api/auth/v3/token/refresh
I just get: {"type":"about:blank","title":"Method Not Allowed","status":405,"detail":"Method 'GET' is not supported.","instance":"/api/auth/v3/token/refresh"} and when I go to the network tab in the dev tools I just see this:
image
Any idea on what could be wrong?

The refresh doc with the error code 403 should have the information regarding the cookie, at least that's where I got it from. That GET is not allowed anymore as method is new, but nevertheless you get a cookie, so it doesn't matter in the end.

Hmm not sure I get it. Before I just had to copy the value from the datadome field and it was working. Now there is no datadome field at all.

There should be a datadome value.
It should be in the details of the network tab in the developer tools for the refresh value where you get the 405, when you click on it. Somewhere with the value 'cookie' or 'set-cookie' At least, that's where I found it. I use firefox btw.

@fenooooo
Copy link

J'ai essayé d'appliquer la solution de NickXDD mais après avoir tout essayé, je n'y arrive pas. quelqu'un pourrait-il m'aider ?

Quel genre d'erreurs obtenez-vous ?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Hm... difficile à dire, à vrai dire. Je repartirais complètement de zéro, puis appliquerais les changements mentionnés ici. C'est comme ça que je l'ai fait fonctionner.

Yes but I don't know where and in which file applied the changes indicated above

@c0lumb0
Copy link

c0lumb0 commented Jan 26, 2024

J'ai essayé d'appliquer la solution de NickXDD mais après avoir tout essayé, je n'y arrive pas. quelqu'un pourrait-il m'aider ?

Quel genre d'erreurs obtenez-vous ?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Hm... difficile à dire, à vrai dire. Je repartirais complètement de zéro, puis appliquerais les changements mentionnés ici. C'est comme ça que je l'ai fait fonctionner.

Yes but I don't know where and in which file applied the changes indicated above

This

"headers": {
"User-Agent": "TooGoodToGo/23.12.1 (550) (iPhone/iPhone 11 (GSM); iOS 16.3.1; Scale/2.00)",
"Cookie": ""
}

is done in the config file.

@fenooooo
Copy link

J'ai essayé d'appliquer la solution de NickXDD mais après avoir tout essayé, je n'y arrive pas. quelqu'un pourrait-il m'aider ?

Quel genre d'erreurs obtenez-vous ?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Hm... difficile à dire, à vrai dire. Je repartirais complètement de zéro, puis appliquerais les changements mentionnés ici. C'est comme ça que je l'ai fait fonctionner.

Yes but I don't know where and in which file applied the changes indicated above

This

"headers": {
"User-Agent": "TooGoodToGo/23.12.1 (550) (iPhone/iPhone 11 (GSM); iOS 16.3.1; Scale/2.00)",
"Cookie": ""
}

is done in the config file.

I put it in the config.defaults.json file, but I still get the same error, nothing has changed

@c0lumb0
Copy link

c0lumb0 commented Jan 29, 2024

J'ai essayé d'appliquer la solution de NickXDD mais après avoir tout essayé, je n'y arrive pas. quelqu'un pourrait-il m'aider ?

Quel genre d'erreurs obtenez-vous ?

Something went wrong: HTTPError: Response code 403 () at Request.<anonymous> (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:629:26) at Request.emit (node:events:526:35) at Request._onResponseBase (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:727:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///C:/Users/jules/AppData/Roaming/npm/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Hm... difficile à dire, à vrai dire. Je repartirais complètement de zéro, puis appliquerais les changements mentionnés ici. C'est comme ça que je l'ai fait fonctionner.

Yes but I don't know where and in which file applied the changes indicated above

This

"headers": {
"User-Agent": "TooGoodToGo/23.12.1 (550) (iPhone/iPhone 11 (GSM); iOS 16.3.1; Scale/2.00)",
"Cookie": ""
}

is done in the config file.

I put it in the config.defaults.json file, but I still get the same error, nothing has changed

You have to check the cached config file as well.
The first time you started the application, a cached config is saved from the config defaults json file. So if you did not change it in there as well, it will not work, since the old information in the cached config is used, which leads to the error. The cached config file is somewhere else in the directories.

So, delete the cached config or change it in there as well or install the application/NodeJS from scratch, then it should work.

@jjavierrg
Copy link

jjavierrg commented Feb 6, 2024

I think it is a problem with the headers. I've added the following configuration to my config.json file and it seems to be working normally again

    "headers": {
      "User-Agent": "TGTG/21.1.12 Dalvik/2.1.0 (Linux; Android 12; SM-G920V Build/MMB29K)'"
    }

and also change "deviceType": "IOS" to "deviceType": "ANDROID"

Then I redeployed the container (in my case I use docker), did the login command first and then watch command and everything worked perfectly.

I have also noticed that if I deploy it on a server in another country other than where my account is configured, then it returns 403 error, but if I deploy it on a server at home, it no longer returns the 403.

@marklagendijk
Copy link
Owner

I have not seen any evidence that changing the coordinates makes any difference.
@jjavierrg I tried your suggestions and they worked, so I updated the config and made a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.