dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
683 stars 162 forks source link

discord.errors.LoginFailure: Improper token has been passed. #312

Closed viceywiceyuwu closed 2 years ago

viceywiceyuwu commented 2 years ago

Summary

token isn't working

Reproduction Steps

  1. Go to discord
  2. Logout
  3. Log in wiht network tab in dev tools
  4. Go to science
  5. Grab the token

I did this to get my user token since going to application -> local storage and then getting the token from there doesnt work anymore

Code

from discord.ext import commands
import discord

client = discord.Client()

@client.event
async def on_ready():
    print('e')

client.run('frick off')

### Expected Results

It's supposed to print('e')

### Actual Results

Traceback (most recent call last): File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\http.py", line 349, in static_login data = await self.request(Route('GET', '/users/@me')) File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\http.py", line 302, in request
raise HTTPException(r, data) discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

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

Traceback (most recent call last): File "C:\Users\creep\Desktop\sus\Stewy\index.py", line 10, in client.run('no') File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\client.py", line 631, in run return future.result() File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\client.py", line 610, in runner await self.start(*args, *kwargs) File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\client.py", line 573, in start await self.login(args) File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\client.py", line 424, in login await self.http.static_login(token.strip()) File "C:\Users\creep\Desktop\sus\Stewy\env\lib\site-packages\discord\http.py", line 353, in static_login raise LoginFailure('Improper token has been passed.') from exc discord.errors.LoginFailure: Improper token has been passed. Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000020D0012DD80> Traceback (most recent call last): File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in del self.close() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon self._check_closed() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000020D0012DD80> Traceback (most recent call last): File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in del self.close() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon self._check_closed() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000020D0012DD80> Traceback (most recent call last): File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in del self.close() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon self._check_closed() File "C:\Users\creep\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed



### System Information

- Python v3.10.5-final
- discord.py-self v1.9.2-final      
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19044

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shared the entire traceback.
- [X] I am using a user token (and it isn't visible in the code).

### Additional Information

_No response_
dolfies commented 2 years ago

This error will only occur if your token is invalid. Make sure you aren't obtaining the analytics token, and that you aren't overwriting dpy-self with dpy or another fork.

viceywiceyuwu commented 2 years ago

Pretty sure it isn't a analytics token.

After the encryption update tokens have been frigged, how should I go about getting my token now?