question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

discord.errors.LoginFailure: Improper token has been passed

See original GitHub issue

Summary

When i try to run my code it shows discord.errors.LoginFailure: Improper token has been passed

Reproduction Steps

1)install discord.py 2)run code

Minimal Reproducible Code

bot.run("TOKEN")

Expected Results

Run the discord bot normally

Actual Results

Shows error

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\http.py", line 299, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\http.py", line 253, 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 ".\bot.py", line 62, in <module>
    bot_async_start()
  File ".\bot.py", line 49, in bot_async_start
    bot.run("Here there is the token ")
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 755, in run
    return future.result()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 734, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 697, in start
    await self.login(*args)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 544, in login
    await self.http.static_login(token.strip())
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\http.py", line 303, in static_login
    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.

Intents

discord.Intents.default

System Information

  • Python v3.8.6-final
  • discord.py v1.8.1-final
  • aiohttp v3.7.4.post0
  • system info: Windows 10 10.0.22000

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

The token is correctly copied , is the token not the secret, the token is in a string , I also tried to regenerate token and it didn’t worked

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Asquatorcommented, Jun 29, 2022

I’m having the same issue while trying to create a self bot (automatizing my main account). How can I fix it?

2reactions
GoogleGeniuscommented, Jun 29, 2022

Using self-bots is against ToS and discord.py has removed all methods and any references to them in v2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improper token passed - python - Stack Overflow
It says: discord.errors.LoginFailure: Improper token has been passed. Before anyone asks, yes I have put in the bot token, not ...
Read more >
discord.py-self Improper token has been passed. - Reddit
I have been using discord.py-self for quite a while now, but after some time, it started showing me this error: discord.errors.LoginFailure: ...
Read more >
improper token passed · Issue #30 · dolfies/discord.py-self
1]: discord.errors.LoginFailure: Improper token has been passed. Token must be exclusively from a user account, BOT tokens are not supported.
Read more >
Hey umm so can someone help me out? Coding a simple ...
Every time I try to run my bot, I get this error that has to do with the final line. ... raise LoginFailure('Improper...
Read more >
Trying to follow discord bot tutorial - The freeCodeCamp Forum
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized ... raise LoginFailure('Improper token has been passed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found