marklagendijk/node-toogoodtogo-watcher

I can't watch (403 error)

Closed this issue · 11 comments

Hi all,

I have this issue as soon as I start the whatch:

Error during request:
POST https://apptoogoodtogo.com/api/item/v7/
{
    "favorites_only": true,
    "origin": {
        "latitude": 52.5170365,
        "longitude": 13.3888599
    },
    "radius": 200,
    "user_id": "13612216"
}

HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/home/pi/.nvm/versions/node/v15.3.0/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

Any idea?
Alex

Same here...

Error during request:
POST https://apptoogoodtogo.com/api/item/v7/
{
    "favorites_only": true,
    "origin": {
        "latitude": 52.5170365,
        "longitude": 13.3888599
    },
    "radius": 200,
    "user_id": "21740xxx"
}

HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/usr/local/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:117:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Still works on my side, just did a restart and it works fine, but there was a request on the mobile device to update the TGTG app, maybe in that course, the apis were again changed, so that now it is v8 instead of v7, if I'm not mistaking, that error message was the same back then.

Thanks for your input!

Just changes the API endpoint to target item/v8/ but to no avail, still getting the same error message...

Did you change v7 to v8 everywhere v7 is set in the code?

Did you change v7 to v8 everywhere v7 is set in the code?

I only found a corresponding entry in toogoodtogo-watcher/lib/api.js, no other files seemed affected...?

Ok, otherwise just update the repo and/or reinstall, this helped here, which could be the same...v7 should just be in api.js, correct.
#159

Did that just now but didn't help...

Ran toogoodtogo-watcher login again just to make sure and that works fine.

Clueless as to what I am doing wrong here, was working fine a couple of weeks ago?

Honestly, can't tell at the moment, since on my side, it still works...sorry

@E-VANCE I incurred into a similar issue recently, and I solved it by doing a fresh new installation (and by deleting the old config file). Hope it helps

@lnovelli Thanks, that did the trick! 🎉

The issue most probably is rooted in the wrong headers-setting that I had in the config from before and the missing deviceType-param... Also the pollingIntervalInMs decreased but that's rather minor I'd assume.

So it changed from

"headers": {
  "User-Agent": "TooGoodToGo/21.9.3 (541) (iPhone/iPhone 7 (GSM); iOS 13.6; Scale/2.00)"
},
"pollingIntervalInMs": 20000,

to

"deviceType": "IOS",
"headers": {},
"pollingIntervalInMs": 30000,

@aperezna Can you test and confirm this? And close the issue then?

Cheers!

Thank you very much @E-VANCE , with this change it works correctly