A Discord client secret is the confidential half of the OAuth2 credentials of a Discord application. Paired with the public client ID, it lets whoever holds it act as your application in the OAuth2 flow: exchange an authorization code for an access token, refresh a user’s token, or request tokens for the application. The danger is impersonation of your login flow, where users who authorize your app end up giving tokens to someone else, with the scopes they approved, such as their identity or email. The client secret is not the bot token, which is a separate secret. Reset the client secret first, then check the application.
Check your GitHub account for leaked secrets — free
- Provider
- Discord
- Severity
- High
- Impact
- Source code and build access
- Checked live by LeakWatch
- No
What a Discord Client Secret looks like
A client secret is a string of 32 characters, made of letters, digits, dashes and underscores:
DISCORD_CLIENT_SECRET=XXXX…XXXX 32 characters, no fixed prefix (masked)
Unlike many tokens, it has no distinctive prefix, so the value alone is not recognizable. What identifies it is context: variable names such as DISCORD_CLIENT_SECRET or client_secret next to a Discord client ID, the OAuth2 token endpoint of the Discord API, or a library configuration for a Discord login. Do not confuse it with other Discord values. The client ID is a numeric identifier, public by design. The bot token is longer, has three dot-separated parts and gives control of the bot user (see Discord bot token). The public key used to verify interactions is not a secret either. If you leaked the client secret, look in the same file for the bot token.
How Discord Client Secrets get leaked
- OAuth login configuration. A web app with “Login with Discord” whose client ID and secret were put in a settings file, a
.envor an auth library config and committed. - Frontend bundles. A secret placed in a front-end environment variable that the build embeds into JavaScript served to every visitor.
- Bot dashboards. Open-source Discord bot projects and dashboards with a sample config that was filled with real values.
- Docker and CI files. Compose files or workflow files with the secret written inline.
- Tutorials and help requests. A code sample or a screenshot of the developer page pasted into a forum or a chat when asking for help.
What to do in the first hour
- Reset the client secret. In the Discord developer portal, open your application, go to its OAuth2 settings and reset the client secret. The new value replaces the old one. Discord may ask you to confirm your identity, for example with two-factor authentication.
- Deploy the new secret to your server or secret manager and restart the service that performs the OAuth exchange. Until you do, logins through Discord will fail.
- Review the redirect URIs. In the same settings, check the list of allowed redirects. Remove any you do not recognize, because an attacker with the secret could combine it with a redirect they control.
- Check the rest of the application. Look at the team members of the application, the bot settings, and whether the bot token also leaked; if so, reset it too.
- Look at your own side. Review the logs of your login endpoint for unexpected token exchanges or users that signed in from odd places. If your app stores refresh tokens, consider revoking them so users must sign in again.
- Clean up the code. Move the secret to environment variables and remove it from the history. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at Discord
The client secret is managed in the developer portal, in the OAuth2 area of your application, after you sign in with a Discord account that owns the application or is a member of its team. Open the Discord developer portal, choose the application and look for the section where the client secret is shown, with its reset option. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if the page differs from this description, follow the Discord developer documentation on OAuth2 credentials.
How LeakWatch detects it
The rule is called Discord Client Secret. Because the value has no prefix, the rule does not match a bare 32-character string. It looks for the word discord in any letter case, followed by a short label (up to about 20 characters of letters, digits, dots, dashes or spaces), a separator such as =, : or =>, optional quotes, and then 32 characters from letters, digits, =, _ and -, ending at a delimiter. A line with the secret but no discord before it, or with a shorter value, is not reported. That keeps false alerts low, but a secret placed far from the word can be missed. The severity is high. This type is not checked live: LeakWatch does not send any request to Discord with the secret it found.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Is the Discord client secret the same as the bot token?
No. The client secret belongs to the OAuth2 flow and proves your app’s identity when exchanging codes. The bot token controls the bot user. Reset whichever leaked, and check the other.
Can someone log in as my users with only the client secret?
Not by itself. They also need the client ID and an authorization code or refresh token. But the secret removes a key protection of the flow, so reset it.
Will resetting it break my login?
Yes, until the new secret is deployed. Prepare the change, reset and deploy together, and expect a short interruption if the leak is already being abused.