node-toogoodtogo-watcher: Watch command gives error during token refresh request

After I successfully login with “toogoodtogo-watcher login” with the message You are now successfully logged in! and then try “toogoodtogo-watcher watch” I immediately get the following:

Error during request:
POST https://apptoogoodtogo.com/api/auth/v3/token/refresh
{
    "refresh_token": "..."
}

HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/home/bitnami/.nvm/versions/node/v16.6.2/lib/node_modules/toogoodtogo-watcher/no
de_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

My node version is v16.6.2

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

I was just trying the same, but I get no cookie with postman. Could you tell us how you did that exactly?

What I did:

  1. I went to the following URL in my browser: https://apptoogoodtogo.com/api/auth/v3/token/refresh
  2. Opened my developer tools and opened the Network tap
  3. Completed the CAPTCHA
  4. Checked my last request in the network tab, and copied the ‘datadome’ cookie to the config.json
  5. Restart the watcher
  6. Profit (No idea for how long)

Edit: It worked for a small bit, but it now gives errors again at the refresh 🤔 (even if I update the cookie) Edit2: It seems that refreshing the token doesn’t work, but I do get notifications of new TGTG offers Edit3: After a few days, it still seems to work. I even don’t get any errors refreshing my token

I was just trying the same, but I get no cookie with postman. Could you tell us how you did that exactly?

What I did:

1. I went to the following URL in my browser: https://apptoogoodtogo.com/api/auth/v3/token/refresh

This URL just returns me a 405. Failed to load resource: the server responded with a status of 405 ()

What am I doing wrong?

Please see https://github.com/marklagendijk/node-toogoodtogo-watcher/issues/212#issuecomment-1431987652 for that.

Does it work for somebody?

Yup, it works for me for some days now. Although postman did not get me a datadome cookie, opening the refreshing token request in the browser, with solving the captcha did and then I added the cookie as described:

"deviceType": "IOS", "headers": { "Cookie": "datadome=..." }, "pollingIntervalInMs": 30000,

It does seem to be a datadome issue. I have moved on to trying to get this running on my raspberry pi and there I have the same issues. I took the failed refresh request from my pi to postman on my local pc. Here, after changing the User-Agent in the headers, the refresh request worked and with it I got a datadome cookie. I took this cookie and updated my config like so

"deviceType": "IOS",
"headers": {
    "Cookie": "datadome=..."
},
"pollingIntervalInMs": 30000,

now toogoodtogo-watcher watch seems to be working on my pi, but probably only until my datadome cookie expires. Also since datadome cookie is ip specific I could only use it on other devices in my local network. So the same trick did not work on AWS.

I would not say this a solution, just simply the results of my own investigation to this issue.

In my case, I was trying to run the watcher over on AWS. I believe toogoodtogo might actually be banning ip addresses from AWS. I can get the watcher to work on my local server with no problems.

I run the application on a small windows tablet. When I first got the error, I reinstalled the application from scratch, then it worked for 2 days or so before again getting the error. Now a reinstallation doesn’t work anymore 😦

Maybe it is really an IP issue? Other TGTG applications have similar issues but also related to Datadome protection…