node-toogoodtogo-watcher icon indicating copy to clipboard operation
node-toogoodtogo-watcher copied to clipboard

HTTPError: Response code 403

Open zig284 opened this issue 1 year ago • 13 comments

Hi,

Had this error since 2-3 days. Tested from several servers, with Node.JS v21 and v18. Am i the only one to encouter this issue ?

Something went wrong: HTTPError: Response code 403 () at Request. (file:///usr/lib/node_modules/toogoodtogo-watcher/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:///usr/lib/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:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13) {

Thanks !

zig284 avatar Jan 04 '24 17:01 zig284

Getting the same error even with a fresh install on new PC

Kraker01 avatar Jan 04 '24 23:01 Kraker01

Same here. Some days it works on other days, for 2-3 days now, it shows the error messages. There is also

https://github.com/marklagendijk/node-toogoodtogo-watcher/issues/245

regarding this, so this issue should have popped up in Oct 23 already.

c0lumb0 avatar Jan 05 '24 06:01 c0lumb0

Same error here, I'm running toogoodtogo-watcher --version 4.0.3

HTTPError: Response code 403 () at Request. (file:///home/deucebot/.nvm/versions/node/v18.15.0/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:628:26) at Request.emit (node:events:525:35) at Request._onResponseBase (file:///home/deucebot/.nvm/versions/node/v18.15.0/lib/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:///home/deucebot/.nvm/versions/node/v18.15.0/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:766:13)

Looks like this error is during the login. I tried to login in my telegram bot and got the same error in telegram.

TP8609 avatar Jan 05 '24 08:01 TP8609

That issue doesn't depend on Node version or machine configuration, which it launched on. The nature of it is behind the scenes - it uses same location for all of launched instances, because of it's hardrcoded

export function listFavoriteBusinesses() {
  const session = getSession();

  return api.post("item/v8/", {
    json: {
      favorites_only: true,
      origin: {
        latitude: 52.5170365,
        longitude: 13.3888599,
      },
      radius: 200,
      user_id: session.userId,
    },
    headers: {
      Authorization: `Bearer ${session.accessToken}`,
    },
  });
}

As you can observe in request data was provided location, which is static, and when request is sending to 2good2go api - then it respond with captcha, which doesn't handled. Probably they added it few months ago.

I found the solution for that one issue, but hadn't time to even create PR with bug fix. I'll try to make it later today or tomorrow and mention it in that issue

li7vinov-denis avatar Jan 06 '24 16:01 li7vinov-denis

Hey !

Thanks for your feedback ! I just tried some other tgtg bots. And had the same issue (error 403) i also noticed that the issue is from an uncompleted captcha code. Instead of a previous digit code needed to be type in the console. I use the script from my home place. Phone already connected on the same IP...

I hope the developper of these bots will be able to solve these captcha from the script !

zig284 avatar Jan 07 '24 15:01 zig284

That issue doesn't depend on Node version or machine configuration, which it launched on. The nature of it is behind the scenes - it uses same location for all of launched instances, because of it's hardrcoded

export function listFavoriteBusinesses() {
  const session = getSession();

  return api.post("item/v8/", {
    json: {
      favorites_only: true,
      origin: {
        latitude: 52.5170365,
        longitude: 13.3888599,
      },
      radius: 200,
      user_id: session.userId,
    },
    headers: {
      Authorization: `Bearer ${session.accessToken}`,
    },
  });
}

As you can observe in request data was provided location, which is static, and when request is sending to 2good2go api - then it respond with captcha, which doesn't handled. Probably they added it few months ago.

I found the solution for that one issue, but hadn't time to even create PR with bug fix. I'll try to make it later today or tomorrow and mention it in that issue

I made the changes, i think its because i can't change the ip there i'm running on a NUC and there are more processes running on that device.

TP8609 avatar Jan 07 '24 20:01 TP8609

Just dropping by, beside the 403 error, do you guys also have the problem described in #246?

NickXDD avatar Jan 08 '24 12:01 NickXDD

Got it working, posted the resolution to #248

NickXDD avatar Jan 11 '24 17:01 NickXDD

After being annoyed by 403 every now and then. I used my own project which send the requests through a Chrome browser and this worked perfectly: https://github.com/unixfox/pupflare

  1. I ran my project in local.
  2. Changed https://apptoogoodtogo.com/api/ to http://localhost:3000/?url=https://apptoogoodtogo.com/api/ in this file: https://github.com/marklagendijk/node-toogoodtogo-watcher/blob/master/lib/toogoodtogo-api.js#L8
  3. Ran the app like before. No 403 error. May require two rerun.

unixfox avatar Jan 11 '24 20:01 unixfox

After being annoyed by 403 every now and then. I used my own project which send the requests through a Chrome browser and this worked perfectly: https://github.com/unixfox/pupflare

1. I ran my project in local.

2. Changed `https://apptoogoodtogo.com/api/` to `http://localhost:3000/?url=https://apptoogoodtogo.com/api/` in this file: https://github.com/marklagendijk/node-toogoodtogo-watcher/blob/master/lib/toogoodtogo-api.js#L8

3. Ran the app like before. No 403 error. May require two rerun.

Thanks for the tip, seems to be working for me. Those captcha links were getting annoying.

maarten551 avatar Jan 12 '24 21:01 maarten551

After being annoyed by 403 every now and then. I used my own project which send the requests through a Chrome browser and this worked perfectly: https://github.com/unixfox/pupflare

  1. I ran my project in local.
  2. Changed https://apptoogoodtogo.com/api/ to http://localhost:3000/?url=https://apptoogoodtogo.com/api/ in this file: https://github.com/marklagendijk/node-toogoodtogo-watcher/blob/master/lib/toogoodtogo-api.js#L8
  3. Ran the app like before. No 403 error. May require two rerun.

sadly pupflare doesnt have arm64 distr though, so doesnt work on raspi

Molier avatar Jan 13 '24 09:01 Molier

sadly pupflare doesnt have arm64 distr though, so doesnt work on raspi

You can install it outside of docker. Just install nodejs on raspberry pi and run it...

Anyway I have added ARM64 support on the Docker image so you should be able to use it in Docker now.

unixfox avatar Jan 14 '24 09:01 unixfox

I used the docker image of pupflare for a couple of weeks, worked fine until Feb 9, now I'm getting 403 even when routed through this proxy. Seems like tgtg/Cloudflare upping their game. When I load up the tgtg app on my phone, I'm also getting the captcha puzzles to solve. Anyone else with similar issues and potentially another solution?

Edit: Fixed it by updating to tgtg-watcher 4.0.4, no pupflare needed!

Slothoncrack avatar Feb 18 '24 10:02 Slothoncrack