marklagendijk/node-toogoodtogo-watcher

Error 403

jfadeuilhe opened this issue · 24 comments

Hello,

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

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 processTicksAndRejections (internal/process/task_queues.js:97:5)

Thanks for the quick reaction, but v3.9.0 doesn't work on my Synology :-(

I installed the both components:
npm install -g tough-cookie
npm install -g http-cookie-agent

Do I have to do anything else ?

Good Sunday !

Hi @jfadeuilhe,

According to this issue, closed yesterday, this has just been fixed in the new release. (V3.9.0) :)

Yes, but as stated it does not work for me on Synology

I installed the components indicated in this issue, but do I have to do anything else?

Same here, 403, also actual source looks a bit different than proposed change, not sure if that matters

https://github.com/marklagendijk/node-toogoodtogo-watcher/blob/master/lib/api.js
#148 (comment)

I had the same issue yesterday. I assume it was because my IP was banned after days of invalid requests, because it works with a VPN now.

@jfadeuilhe you have to apply this entire patch.

Maybe banned, indeed.
I suspend my processes and I will try to restart it later.

on the other hand I don't know what to do with "apply this entire patch.", I installed v3.9.0, it doesn't include everything?

on the other hand I don't know what to do with "apply this entire patch.", I installed v3.9.0, it doesn't include everything?

Ah, I misunderstood. You're right, that should be enough.

Hello

I tried to login this morning, without success :

Something went wrong: HTTPError: Response code 403 (Forbidden)
at Request. (/usr/local/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:117:42)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1647845229734,
socket: 1647845229737,
lookup: 1647845229763,
connect: 1647845229776,
secureConnect: 1647845229791,
upload: 1647845229792,
response: 1647845229828,
end: 1647845229836,
error: undefined,
abort: undefined,
phases: {
wait: 3,
dns: 26,
tcp: 13,
tls: 15,
request: 1,
firstByte: 36,
download: 8,
total: 102
}
}
}

I deleted the session info, same result

Hello

I tried to login this morning, without success :

Something went wrong: HTTPError: Response code 403 (Forbidden) at Request. (/usr/local/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:117:42) at processTicksAndRejections (internal/process/task_queues.js:97:5) { code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1647845229734, socket: 1647845229737, lookup: 1647845229763, connect: 1647845229776, secureConnect: 1647845229791, upload: 1647845229792, response: 1647845229828, end: 1647845229836, error: undefined, abort: undefined, phases: { wait: 3, dns: 26, tcp: 13, tls: 15, request: 1, firstByte: 36, download: 8, total: 102 } } }

I deleted the session info, same result

Did you also do the changes for api.js mentioned here
#148 (comment)
?

For me it worked again after that. On my side, this application is running on an small windows tablet.

No need to do manual changes / npm installs. The latest version has the cookieJar applied.

gielk commented

I'm having the same problem. Updated to the latest version but still no success.

Completely removed and reinstalled the package but no success.

root@raspberrypi:/home/pi# toogoodtogo-watcher login
Something went wrong: HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:117:42)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1647869529616,
    socket: 1647869529627,
    lookup: 1647869529638,
    connect: 1647869529658,
    secureConnect: 1647869529695,
    upload: 1647869529696,
    response: 1647869529734,
    end: 1647869529780,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 11,
      dns: 11,
      tcp: 20,
      tls: 37,
      request: 1,
      firstByte: 38,
      download: 46,
      total: 164
    }
  }
}

I feel less alone :)

same here

Looks like they might be banning IP's. Try to login also manually from your phone from same IP, I got captcha.

I disconnected then reconnected on my phone in wifi, with the same IP therefore.

toogoodtogo-watcher login worked "You are now successfully logged in!"

toogoodtogo-watcher watch still makes error

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

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

Help !

Complement...
By looking at the connection confirmation emails, the IP changes: Since the iPhone I had an IPv6 and since watcher an IPv4...

gielk commented

Looks like they might be banning IP's. Try to login also manually from your phone from same IP, I got captcha.

Same I also got a captcha, multiple times, but unfortunately, it is not affecting the bot.

Same problem here. Didn't see any captchas though.
My fridge is looking sad :(

My guess is that there is an issue with the login process.
I didn't do a new login after the changes, and it works fine for me. Others reported the same.

The issue arrived for me without having done anything. It was working fine for months and suddenly i would just get 403s. I only attempted to do a new login a few days ago as it was suggested here, but that didn't solve my problem.

After a break of a few days, I restart the processes and it works!
The problem must have been linked to the banning IP!

My guess is that there is an issue with the login process. I didn't do a new login after the changes, and it works fine for me. Others reported the same.

I did a new login and it worked fine once I had changed my IP.

Not sure how often the IPv4 address changes nowadays with DSLite etc., but at least for me, it's around once per week, which would match with @jfadeuilhe's experience.

Okay so I forced public IP changes by replugging my router (and verifying), and I logged in again several times successfully, with new access and refresh tokens. I've also just tried via VPN (different country IP). But no matter what I do, I still always get 403s when attempting watch. (I'm on the newest tgtg-watcher version of course).

Weird! But it doesn't seem to be an IP-issue for me.

edit: Here's the 403 I'm getting, as I've noticed it is different than the ones posted before (especially the POST request is to a different URL). I'm running on termux on the same phone I have tgtg installed on, never had problems with that setup before.
Since it's a different URL I'm suspecting theres nothing wrong with me getting logged in, just somehow fetching the requested items causes errors...? I also tested removing my "favourite" tgtg places, but that didnt change anything.

~/.config/toogoodtogo-watcher-nodejs $ toogoodtogo-watcher watch
Error during request:
POST https://apptoogoodtogo.com/api/item/v7/
{
    "favorites_only": true,
    "origin": {
        "latitude": <my latitude>,
        "longitude": <my longitude>
    },
    "radius": 200,
    "user_id": "<myuserid>"
}

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

is it possible that they've changed endpoints?

I've completely factory reset my Termux now and reinstalled everything from scratch. It works now! No idea what went wrong on my previous setup.

Closing this because it seems to be a temporary IP ban issue.