Discord error 50014: Invalid authentication token provided
Last verified against Discord Developer Docs - Opcodes and status codes
Invalid authentication token providedWhat error 50014 means
A token was sent, Discord parsed it, and it is not valid. Either it never was (typo, truncated copy, wrong string entirely) or it was valid once and has since been reset. Discord invalidates a bot token when you click Reset Token in the Developer Portal, when the token is detected in a public place such as a GitHub repository, and when the application is deleted or transferred in some flows.
Compare 40001 (no token at all) and gateway 4004 (same bad-token condition, but on the WebSocket). If you see 4004 on connect and 50014 on REST, it is one problem: the token in your environment is not the current one.
Tokens are long base64-ish strings with two dots. A token missing its last few characters still looks plausible, which is why "I copied it correctly" is usually wrong.
What it looks like
{
"message": "401: Unauthorized",
"code": 0
}
// documented example for this code:
{
"message": "Invalid authentication token",
"code": 50014
}Why it happens
- Token reset in the Developer Portal; old value still deployed
- Token leaked to a public repository and automatically revoked by Discord
- Copy truncated, trailing newline or quote included, or whitespace in the env var
- Client secret, public key, or OAuth2 access token pasted where the bot token belongs
- Token from a different (dev/test) application
How to fix Discord error 50014
- 1Developer Portal > your app > Bot > Reset Token, copy the new value once, and update the secret everywhere the bot runs
- 2Trim whitespace and quotes when loading the token; log its length and the number of dots (should be 2) rather than the value
- 3Test with curl -H "Authorization: Bot $TOKEN" https://discord.com/api/v10/users/@me and expect your bot user
- 4If the token was leaked, rotate it and scrub the repository history
- 5Confirm you are using the bot token, not the client secret or public key shown on other tabs
How to stop it recurring
Store the token in a secrets manager and inject it at runtime; never commit it. Add a pre-commit hook or secret scanner to the repository. Keep one token per environment and name the env vars so dev and prod cannot be confused.
Official reference: Discord Developer Docs - Opcodes and status codes. See all Discord error codes or the Discord limits and quotas.
Related codes
- 40001: UnauthorizedUnauthorized. Provide a valid token and try again
- 4004: Authentication failedThe account token sent with your identify payload is incorrect.
- 50025: Invalid OAuth2 access token providedInvalid OAuth2 access token provided
- 20012: Not authorized to perform this action on this applicationYou are not authorized to perform this action on this application
Error 50014 - quick answers
What does Discord error 50014 mean?
A token was sent, Discord parsed it, and it is not valid. Either it never was (typo, truncated copy, wrong string entirely) or it was valid once and has since been reset. Discord invalidates a bot token when you click Reset Token in the Developer Portal, when the token is detected in a public place such as a GitHub repository, and when the application is deleted or transferred in some flows.
How do I fix Discord error 50014?
1. Developer Portal > your app > Bot > Reset Token, copy the new value once, and update the secret everywhere the bot runs 2. Trim whitespace and quotes when loading the token; log its length and the number of dots (should be 2) rather than the value 3. Test with curl -H "Authorization: Bot $TOKEN" https://discord.com/api/v10/users/@me and expect your bot user 4. If the token was leaked, rotate it and scrub the repository history 5. Confirm you are using the bot token, not…
Stop debugging Discord by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.