marklagendijk/node-toogoodtogo-watcher

Telegram Login Error

Opened this issue · 13 comments

oelf commented

Hi,
Telegram Bot gets error after command "/login email".

Something went wrong "HTTPError: Response code 403 ()\n at Request.<anonymous> (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42)\n at Object.onceWrapper (node:events:627:26)\n at Request.emit (node:events:524:35)\n at Request._onResponseBase (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:726:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Request._onResponse (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:765:13)"

I have same problem but got error code 400

Same issue here! Tried also with command line login and get:

Something went wrong: HTTPError: Response code 403 (Forbidden) at Request.<anonymous> (file:///home/node/app/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/node/app/node_modules/got/dist/source/core/index.js:726:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///home/node/app/node_modules/got/dist/source/core/index.js:765:13) { input: undefined, code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1680015472926, socket: 1680015472927, lookup: 1680015472927, connect: 1680015472934, secureConnect: 1680015472942, upload: 1680015472942, response: 1680015472985, end: 1680015472990, error: undefined, abort: undefined, phases: { wait: 1, dns: 0, tcp: 7, tls: 8, request: 0, firstByte: 43, download: 5, total: 64 } }, options: { request: undefined, agent: { http: undefined, https: undefined, http2: undefined }, h2session: undefined, decompress: true, timeout: { connect: undefined, lookup: undefined, read: undefined, request: undefined, response: undefined, secureConnect: undefined, send: undefined, socket: undefined }, prefixUrl: '', body: '{"device_type":"IOS","email":"$MY_EMAIL"}', form: undefined, json: undefined, cookieJar: CookieJar { rejectPublicSuffixes: true, enableLooseMode: false, allowSpecialUseDomain: true, store: { idx: { 'apptoogoodtogo.com': { '/': { datadome: Cookie="datadome=20VfqwjrMsPPvI52dCymbyJu02RRSog8oYpusu0dT5Bx5Qcqe4vk6B9aeuCVFO96Xbu6IvRbxEQGGMRjFcEHBRqv-BxihvO0XjFEtcfXKsAKOCH_t2mMKxaY4_ow3_Un; Max-Age=5184000; Domain=apptoogoodtogo.com; Path=/; Secure; SameSite=Lax; hostOnly=false; aAge=16ms; cAge=3315ms" } } } }, prefixSecurity: 'silent', _cloneSync: [Function (anonymous)], _importCookiesSync: [Function (anonymous)], getCookiesSync: [Function (anonymous)], getCookieStringSync: [Function (anonymous)], getSetCookieStringsSync: [Function (anonymous)], removeAllCookiesSync: [Function (anonymous)], setCookieSync: [Function (anonymous)], serializeSync: [Function (anonymous)] }, ignoreInvalidCookies: false, searchParams: undefined, dnsLookup: undefined, dnsCache: undefined, context: {}, hooks: { init: [], beforeRequest: [], beforeError: [], beforeRedirect: [], beforeRetry: [], afterResponse: [] }, followRedirect: true, maxRedirects: 10, cache: undefined, throwHttpErrors: true, username: '', password: '', http2: false, allowGetBody: false, headers: { 'user-agent': 'TooGoodToGo/21.9.0 (813) (iPhone/iPhone 7 (GSM); iOS 15.1; Scale/2.00)', 'content-type': 'application/json; charset=utf-8', accept: 'application/json', 'accept-language': 'en-US', 'accept-encoding': 'gzip', 'content-length': '67', cookie: 'datadome=rtDFaK16XYmn0~Ay_dE8Cx2xnEbi-i9gDzC7fDjq92xmcK7wRMa7BhvB8xqbyRAEaCr0fxrwjtrxz2MyGPf4BYwgUR4A2u6uiE-O_dDsWOwgUFHKRDwsyAAGo2Krs3p' }, methodRewriting: false, dnsLookupIpVersion: undefined, parseJson: [Function: parse], stringifyJson: [Function: stringify], retry: { limit: 2, methods: [ 'GET', 'POST', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ], statusCodes: [ 401, 403, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524 ], errorCodes: [ 'ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN' ], maxRetryAfter: undefined, calculateDelay: [Function: calculateDelay], backoffLimit: Infinity, noise: 100 }, localAddress: undefined, method: 'POST', createConnection: undefined, cacheOptions: { shared: undefined, cacheHeuristic: undefined, immutableMinTimeToLive: undefined, ignoreCargoCult: undefined }, https: { alpnProtocols: undefined, rejectUnauthorized: undefined, checkServerIdentity: undefined, certificateAuthority: undefined, key: undefined, certificate: undefined, passphrase: undefined, pfx: undefined, ciphers: undefined, honorCipherOrder: undefined, minVersion: undefined, maxVersion: undefined, signatureAlgorithms: undefined, tlsSessionLifetime: undefined, dhparam: undefined, ecdhCurve: undefined, certificateRevocationLists: undefined }, encoding: undefined, resolveBodyOnly: true, isStream: false, responseType: 'json', url: URL { href: 'https://apptoogoodtogo.com/api/auth/v3/authByEmail', origin: 'https://apptoogoodtogo.com', protocol: 'https:', username: '', password: '', host: 'apptoogoodtogo.com', hostname: 'apptoogoodtogo.com', port: '', pathname: '/api/auth/v3/authByEmail', search: '', searchParams: URLSearchParams {}, hash: '' }, pagination: { transform: [Function: transform], paginate: [Function: paginate], filter: [Function: filter], shouldContinue: [Function: shouldContinue], countLimit: Infinity, backoff: 0, requestLimit: 10000, stackAllItems: false }, setHost: true, maxHeaderSize: undefined, signal: undefined, enableUnixSockets: true } }

Hi, Telegram Bot gets error after command "/login email".

Something went wrong "HTTPError: Response code 403 ()\n at Request.<anonymous> (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/as-promise/index.js:86:42)\n at Object.onceWrapper (node:events:627:26)\n at Request.emit (node:events:524:35)\n at Request._onResponseBase (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:726:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Request._onResponse (file:///usr/lib/node_modules/toogoodtogo-watcher/node_modules/got/dist/source/core/index.js:765:13)"

HTTP 403 is the error code for "forbidden", means the host blocked your request. This often happens when your IP is temp banned for sending too many requests or failing the bot check.

Did you update to the latest version that supports the datadome cookies?

@basti1499 I did update to latest version and always get this issue as well, so this looks more like a permanent ban more than a temporary one (maybe the bot check is failing). I am using a private server not a cloud environment.

@basti1499 I did update to latest version and always get this issue as well, so this looks more like a permanent ban more than a temporary one (maybe the bot check is failing). I am using a private server not a cloud environment.

Can you try opening https://apptoogoodtogo.com/api/auth/v3/token/refresh in a browser on the same network as your server?

If you get HTTP error 405 you're good, then your IP is not being blocked.
You might get the captcha, which you then would need to solve.

What kind of server are you using? Hosted at home or in some data center?

@basti1499 If I open the refresh page sometimes I get 405 directly and sometimes the captcha; anyway, even after solving it, I am still unable to login via telegram bot (same error as original reporter).

I am using a Ubuntu server in office and opening tgtg website from a laptop in the same LAN, with same public IP.
The watcher is running as a Docker container.

@basti1499 If I open the refresh page sometimes I get 405 directly and sometimes the captcha; anyway, even after solving it, I am still unable to login via telegram bot (same error as original reporter).

I am using a Ubuntu server in office and opening tgtg website from a laptop in the same LAN, with same public IP. The watcher is running as a Docker container.

I'd suggest to turn the bot off for a few hours/days and check whether the captcha check went away.
Captcha check means that your IP is being tagged as potentially malicious and therefore you are required to solve the captcha, which can't be done by the bot ofc.

Can you run a browser instance on your server and solve the captcha there? This might trigger tgtg to send your server the necessary datadome cookie.

@basti1499 Tried with a browser instance on same server, solved the captcha and got again same login error trough telegram bot.

@basti1499 Tried with a browser instance on same server, solved the captcha and got again same login error trough telegram bot.

Then maybe it's time to let the bot rest a few days :)

@basti1499 the watcher has been shut down since my first post on this issue (2 weeks ago) up to this afternoon but yet no luck :(

@basti1499 the watcher has been shut down since my first post on this issue (2 weeks ago) up to this afternoon but yet no luck :(

Oh, then I don't really know what else you could try.
Your error looks very similar to what I had previously, also the thing with the captcha, but it worked to shut it down for a few days.

@basti1499 the watcher has been shut down since my first post on this issue (2 weeks ago) up to this afternoon but yet no luck :(

Another idea, did you try to fully uninstall the bot and start from scratch? Maybe some old config/cookie is hanging somewhere...

@basti1499 I am running the watcher as a Docker container; I have tried to tier down and recreate it many times, even with a brand new config file but I always get the same behaviour.

Here is my config file for reference:

{
	"api": {
		"credentials": {
			"email": "YYYYYYYYY"
		},
		"session": {},
		"deviceType": "IOS",
		"headers": {},
		"pollingIntervalInMs": 30000,
		"authenticationIntervalInMS": 3600000
	},
	"notifications": {
		"console": {
			"enabled": false,
			"clear": true
		},
		"desktop": {
			"enabled": false
		},
		"telegram": {
			"enabled": true,
			"botToken": "XXXXXXXXX",
			"chats": [
				{
					"id": -00000000,
					"firstName": "Andrea",
					"lastName": "Vida"
				}
			]
		},
		"apprise": {
			"enabled": false,
			"host": "apprise:8080",
			"services": [
				{
					"url": "Any Apprise Notification service URL. Example: mailto://domain.com?user=userid&pass=password. See https://github.com/caronc/apprise#table-of-contents",
					"format": "The message format, as supported by this notification service. Can be `html`, `text`"
				}
			]
		}
	},
	"messageFilter": {
		"showUnchanged": false,
		"showDecrease": false,
		"showDecreaseToZero": false,
		"showIncrease": false,
		"showIncreaseFromZero": true
	}
}