node-toogoodtogo-watcher: HTTPError: Response code 403 (Forbidden)

Starting this afternoon I got my first Captcha request within the toogoodtogo app itself.

At the exact same time the toogoodtogo-watcher started receiving 403 errors. I have attempted to reinstall and login but upon logging in I only get the following error message:

Something went wrong: HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\toogoodtogo-watcher\node_modules\got\dist\source\as-promise\index.js:117:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1647539004170,
    socket: 1647539004173,
    lookup: 1647539004199,
    connect: 1647539004219,
    secureConnect: 1647539004258,
    upload: 1647539004259,
    response: 1647539004320,
    end: 1647539004329,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 3,
      dns: 26,
      tcp: 20,
      tls: 39,
      request: 1,
      firstByte: 61,
      download: 9,
      total: 159
    }
  }
}

This is my config file:

{
	"api": {
		"credentials": {
			"email": "xxxxxxx@gmail.com"
		},
		"session": {},
		"deviceType": "IOS",
		"headers": {},
		"pollingIntervalInMs": 30000,
		"authenticationIntervalInMS": 3600000
	},
	"notifications": {
		"console": {
			"enabled": false,
			"clear": true
		},
		"desktop": {
			"enabled": true
		},
		"telegram": {
			"enabled": false,
			"botToken": "See README",
			"chats": []
		},
		"ifttt": {
			"enabled": false,
			"webhookKey": "see README",
			"webhookEvents": [
				"see README"
			]
		},
		"gotify": {
			"enabled": false,
			"url": "http://push.example.com",
			"apptoken": "token",
			"priority": 5
		}
	},
	"messageFilter": {
		"showUnchanged": false,
		"showDecrease": false,
		"showDecreaseToZero": false,
		"showIncrease": false,
		"showIncreaseFromZero": true
	}
}

This was the original error message:

HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\toogoodtogo-watcher\node_modules\got\dist\source\as-promise\index.js:117:42)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error during request:
POST https://apptoogoodtogo.com/api/item/v7/
{
    "favorites_only": true,
    "origin": {
        "latitude": xx.xxxxxx,
        "longitude": xx.xxxxxxx
    },
    "radius": 200,
    "user_id": "xxxxxxxxxx"
}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I think I’ve fixed it, not sure if it’s the best solution and if it works on all devices… but has been running (on raspberry) without issues for the past hour. Cookies need to be enabled for the requests to work again.

You need to install the tough-cookie and http-cookie-agent module.

api.js edits:

const got = require("got");
const { config } = require("./config");
const { CookieJar } = require("tough-cookie");
const { HttpCookieAgent, HttpsCookieAgent } = require('http-cookie-agent');

const jar = new CookieJar();

const api = got.extend({
agent: {
    http: new HttpCookieAgent({ jar }),
    https: new HttpsCookieAgent({ jar }),
  },
.... headers etc. ....

Thanks for the fix. I’m too lazy / busy to look into things myself. However, I usually do (eventually) find the time to apply stuff other people figured out. Fix has been released.

HTTPError: Response code 403 (Forbidden) at Request.<anonymous> (C:\Users\k\AppData\Roaming\npm\node_modules\toogoodtogo-watcher\node_modules\got\dist\source\as-promise\index.js:117:42) at processTicksAndRejections (node:internal/process/task_queues:96:5) Error during request: POST https://apptoogoodtogo.com/api/item/v7/

I have been getting this error when I run watch command, could this be some type of captcha thing?

So far reinstalling the app and logging back in didn’t work, using a different account with different IP did also not work. I always get the above error message when I try the watch command

Login works perfect btw

yeah you now need to provide the “cookie” in the request, might send a PR if the owner don’t resolve it in the following days