giorgi-o / SkinPeek

Awesome Valorant Discord bot to see your daily shop, night market, battlepass progression, and much more
GNU General Public License v3.0
195 stars 86 forks source link

unexpected token < in JSON at position 0 #93

Closed eznxxy closed 10 months ago

eznxxy commented 11 months ago

when im trying to use /login command, im facing this error any recommendation how to fix it?

OS: Windows 10 Home Single Language v22H2 Nodejs: 16.19.0

Riot didn't return any cookies during the auth request! Cloudflare might have something to do with it... SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at redeemUsernamePassword (file:///C:/Users/Velociraptor/Downloads/Compressed/SkinPeek-master/valorant/auth.js:162:24) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async queueUsernamePasswordLogin (file:///C:/Users/Velociraptor/Downloads/Compressed/SkinPeek-master/valorant/authQueue.js:33:38) at async loginUsernamePassword (file:///C:/Users/Velociraptor/Downloads/Compressed/SkinPeek-master/discord/authManager.js:40:17) at async Client. (file:///C:/Users/Velociraptor/Downloads/Compressed/SkinPeek-master/discord/bot.js:910:21)

giorgi-o commented 11 months ago

So Rito seem to have added hcaptcha to the username+password endpoint... 😭

What this means is that normally, if you were on the website or the Riot client, there would be a popup asking you to solve a captcha. But SkinPeek, being a discord bot, can't solve those.

This only happens when using SkinPeek from an enterprise IP address, i.e. a VPS/dedicated server/VPN. From a residential (home) IP, it still works as it always has. So self-hosting the bot might be a temporary workaround.


While investigating, I tried turning on a VPN on my PC, and the official Riot client wouldn't let me log in. Yes, the Riot client doesn't work over a VPN at the moment. To me, this seems like some sort of emergency response from Rito, hopefully temporary since blocking all VPN users seems very much overkill.

So, what now? Well, I'll keep looking, but there doesn't seem to be a quick & easy fix, at least not at the moment. I'll try and keep this thread updated as soon something changes or new info is found.

eznxxy commented 11 months ago

Ahh i see that's make sense.

Well this is my first time create a discord bot so im just install it on my own machine, and for now as you mentioned above i will try to self-hosting the bot.

Anyway thank you, your explanation is nice.

tylernguyen commented 11 months ago

I'm running into this issue self-hosting the bot. I have 4 users.

Edit: Fixed since the latest commit.

giorgi-o commented 11 months ago

Completely forgot to mention it here (sorry!) but commit 70b485560b4dcf8a5f0221afa9476b6ffd0ecfe4 seems to have fixed it, at least for now. If anyone still gets an error after updating, please let me know.

eznxxy commented 10 months ago

Yepp its work for me, thanks