Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login Command: decode JSON failed #57

Closed
doluk opened this issue Jun 13, 2022 · 17 comments
Closed

Login Command: decode JSON failed #57

doluk opened this issue Jun 13, 2022 · 17 comments
Labels
bug Something isn't working

Comments

@doluk
Copy link

doluk commented Jun 13, 2022

Using the login command results in an error.
image
changing the code in
https://github.com/staciax/Valorant-DiscordBot/blob/c76f330f2d3d1dc691330e542dab056fc3122dd2/utils/valorant/auth.py#L97 to disable the content_type check to r.json(content_type=None) reveals that the response of the riot games api to https://auth.riotgames.com/api/v1/authorization is returning a 403.
I don't know what your source is but the same issue is mentioned here but the suggest fix doesn't work for me.
I also found this which might be helpful.

@staciax
Copy link
Owner

staciax commented Jun 13, 2022

cloudflare updated about ssl 2 days ago

I try to fix it every day.

Some people can use it normally. Some people just can't use it.

@staciax staciax pinned this issue Jun 13, 2022
@staciax staciax added the bug Something isn't working label Jun 13, 2022
@doluk
Copy link
Author

doluk commented Jun 13, 2022

Oh wait I think this time it could actually be not on your side. AFAIK there a currently some issues with the login in the game client too.

BTW thx for the fast response

@doluk
Copy link
Author

doluk commented Jun 13, 2022

Okay the server issues seems to be fixed. At least I can login again in the game

@osu
Copy link

osu commented Jun 14, 2022

I also have the same issue, here is the error when trying to login, but instead of showing me an error on discord it just says that the application isn't available and it outputs me this in the console.

 BOT IS READY !
Version: 3.1.0-aiohttp
Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper()                                                   done, defined at /usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py:987> exception=TypeE                                                  rror('Subscripted generics cannot be used with class and instance checks')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 649, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/mana/valorant/cogs/valorant.py", line 97, in login
    authenticate = await auth.authenticate(username, password)
  File "/home/mana/valorant/utils/valorant/auth.py", line 94, in authenticate
    data = await r.json()
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype:                                                   text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1156, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 675, in _invoke_wi                                                  th_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'login' raised an exception: ContentTypeError: 0,                                                   message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://au                                                  th.riotgames.com/api/v1/authorization')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 989, in wrapper
    await self.call(interaction)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1159, in call
    await self.on_error(interaction, e)
  File "/home/mana/valorant/cogs/errors.py", line 64, in on_app_command_error
    elif isinstance(error, Union[AppCommandNotFound, MissingPermissions, BotMissingPermissions]):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
Unclosed client session
client_session: <utils.valorant.auth.ClientSession object at 0x7f86357eef40>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f86358e7640>, 8266831.166564328)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f86357e60d0>

INFO - I'm using the latest release.

@staciax
Copy link
Owner

staciax commented Jun 14, 2022

try master version

@Nicolr33
Copy link

I also have the same issue, here is the error when trying to login, but instead of showing me an error on discord it just says that the application isn't available and it outputs me this in the console.

 BOT IS READY !
Version: 3.1.0-aiohttp
Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper()                                                   done, defined at /usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py:987> exception=TypeE                                                  rror('Subscripted generics cannot be used with class and instance checks')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 649, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/mana/valorant/cogs/valorant.py", line 97, in login
    authenticate = await auth.authenticate(username, password)
  File "/home/mana/valorant/utils/valorant/auth.py", line 94, in authenticate
    data = await r.json()
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype:                                                   text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1156, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 675, in _invoke_wi                                                  th_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'login' raised an exception: ContentTypeError: 0,                                                   message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://au                                                  th.riotgames.com/api/v1/authorization')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 989, in wrapper
    await self.call(interaction)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1159, in call
    await self.on_error(interaction, e)
  File "/home/mana/valorant/cogs/errors.py", line 64, in on_app_command_error
    elif isinstance(error, Union[AppCommandNotFound, MissingPermissions, BotMissingPermissions]):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
Unclosed client session
client_session: <utils.valorant.auth.ClientSession object at 0x7f86357eef40>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f86358e7640>, 8266831.166564328)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f86357e60d0>

INFO - I'm using the latest release.

It didn't work for me either, I deleted and reinstalled and it works! @osu

@osu
Copy link

osu commented Jun 14, 2022

try master version

Using master version got this error still.

BOT IS READY !
Version: 3.1.0-aiohttp
Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py:987> exception=TypeError('Subscripted generics cannot be used with class and instance checks')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 649, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/mana/valorant/cogs/valorant.py", line 97, in login
    authenticate = await auth.authenticate(username, password)
  File "/home/mana/valorant/utils/valorant/auth.py", line 114, in authenticate
    data = await r.json()
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1156, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 675, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'login' raised an exception: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 989, in wrapper
    await self.call(interaction)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1159, in call
    await self.on_error(interaction, e)
  File "/home/mana/valorant/cogs/errors.py", line 64, in on_app_command_error
    elif isinstance(error, Union[AppCommandNotFound, MissingPermissions, BotMissingPermissions]):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
Unclosed client session
client_session: <utils.valorant.auth.ClientSession object at 0x7f2726107640>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f2725567be0>, 8288210.421658162)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f2725440370>

@staciax
Copy link
Owner

staciax commented Jun 14, 2022

cloudflare gave me a huge headache.

you can try again master

staciax added a commit that referenced this issue Jun 14, 2022
@osu
Copy link

osu commented Jun 14, 2022

cloudflare gave me a huge headache.

you can try again master

Tried again importing master directly.

Getting this.

BOT IS READY !
Version: 3.1.3
Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py:987> exception=TypeError('Subscripted generics cannot be used with class and instance checks')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 649, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/mana/valorant/cogs/valorant.py", line 91, in login
    authenticate = await auth.authenticate(username, password)
  File "/home/mana/valorant/utils/valorant/auth.py", line 122, in authenticate
    data = await r.json()
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1156, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 675, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'login' raised an exception: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 989, in wrapper
    await self.call(interaction)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1159, in call
    await self.on_error(interaction, e)
  File "/home/mana/valorant/cogs/errors.py", line 47, in on_app_command_error
    elif isinstance(error, Union[AppCommandNotFound, MissingPermissions, BotMissingPermissions]):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
Unclosed client session
client_session: <utils.valorant.auth.ClientSession object at 0x7f2c91ac9be0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f2c90f6c940>, 8295956.895546693)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f2c91ac9370>

@staciax
Copy link
Owner

staciax commented Jun 14, 2022

Tomorrow I will try to fix it again. ;-;)

@osu
Copy link

osu commented Jun 14, 2022

Tomorrow I will try to fix it again. ;-;)

All good, let me know !

@staciax
Copy link
Owner

staciax commented Jun 15, 2022

Tomorrow I will try to fix it again. ;-;)

All good, let me know !

auth.zip

try replace utils/valorant/auth.py

@osu
Copy link

osu commented Jun 15, 2022

Tomorrow I will try to fix it again. ;-;)

All good, let me know !

auth.zip

try replace utils/valorant/auth.py

Version: 3.1.3
Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py:987> exception=TypeError('Subscripted generics cannot be used with class and instance checks')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 649, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/mana/valorant/cogs/valorant.py", line 91, in login
    authenticate = await auth.authenticate(username, password)
  File "/home/mana/valorant/utils/valorant/auth.py", line 123, in authenticate
    data = await r.json()
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1156, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 675, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'login' raised an exception: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://auth.riotgames.com/api/v1/authorization')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 989, in wrapper
    await self.call(interaction)
  File "/usr/local/lib/python3.9/dist-packages/discord/app_commands/tree.py", line 1159, in call
    await self.on_error(interaction, e)
  File "/home/mana/valorant/cogs/errors.py", line 47, in on_app_command_error
    elif isinstance(error, Union[AppCommandNotFound, MissingPermissions, BotMissingPermissions]):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
Unclosed client session
client_session: <utils.valorant.auth.ClientSession object at 0x7fe2b26aad90>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fe2b1909040>, 8378288.286409643)]']
connector: <aiohttp.connector.TCPConnector object at 0x7fe2b263d730>```

@staciax
Copy link
Owner

staciax commented Jun 16, 2022

os windows 10 right?
You don't use vpn right?

@osu
Copy link

osu commented Jun 16, 2022

os windows 10 right?
You don't use vpn right?

No, Debian OS based server hosted at Hetzner (Nuremberg city)

@staciax
Copy link
Owner

staciax commented Jun 17, 2022

It has to do with protocol, ssl, or internet related stuff, I'm not really sure.

@lennihein
Copy link

Issue still exists, there is no valid response by the Riot Auth servers

shumm7 pushed a commit to shumm7/Valorant-DiscordBot that referenced this issue Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants