ValorantClientAPI icon indicating copy to clipboard operation
ValorantClientAPI copied to clipboard

RSO_AuthFlow.py Attempt to decode JSON with unexpected mimetype

Open L0L1P0P1 opened this issue 2 years ago • 5 comments

Hi, first of all, I'm not very experienced.

Thanks for your good project, but there is a problem that I've encountered. As I try to run RSO_AuthFlow.py, data = await r.json() raises an error for Unexpected mimetype text/http. Is there anything that I'm doing wrong? Is it because of my region?(I changed na to eu and replaced USERNAME etc with my own info) I'll be happy if you help <3

L0L1P0P1 avatar Feb 15 '22 22:02 L0L1P0P1

Hey there,

I'm not a Developer nor have I worked on this, but I took my time to debug the connection since I also wanted to use the API. It sems like they updated something since when you send the request, you get no JSON response back.

You get the following content: <ClientResponse(https://auth.riotgames.com/api/v1/authorization) [403 Forbidden]> <CIMultiDictProxy('Date': 'Sat, 05 Mar 2022 01:45:29 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'X-RiotGames-CDN': 'Cloudflare', 'Vary': 'Accept-Encoding', 'Server': 'cloudflare', 'CF-RAY': '6e6f2c28be552671-TXL', 'Content-Encoding': 'gzip')>

Seems like they updated something to their system or something, I'll look if I get it somehow but other than waiting nothing we can really do.

ImLisaa avatar Mar 05 '22 01:03 ImLisaa

So I found a fix, you actually need to set a header in the ClientSession

session = aiohttp.ClientSession(headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/99.0.4844.51 Safari/537.36"})

ImLisaa avatar Mar 05 '22 01:03 ImLisaa

So I found a fix, you actually need to set a header in the ClientSession

session = aiohttp.ClientSession(headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/99.0.4844.51 Safari/537.36"})

Hi,I got err while using RSO_AuthFlow.py. It seems no changed after using the session you mention T.T

Fatal error on SSL transport
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x000002182291F400>
RuntimeError: Event loop is closed

musnows avatar Jul 04 '22 10:07 musnows

When I check I get this error because it redirects to 403 response. This is not json response.. I think the error here occurs because the file is not returned as json. @Aewait

image

mhcifci avatar Sep 04 '22 02:09 mhcifci

When I check I get this error because it redirects to 403 response. This is not json response.. I think the error here occurs because the file is not returned as json. @Aewait

image

Thanks for the information. Now I use https://github.com/floxay/python-riot-auth to get token,it works well

musnows avatar Sep 04 '22 14:09 musnows