# Leaked X (Twitter) Access Token? Regenerate It Now

> X (Twitter) access token and secret exposed on GitHub? Regenerate them, review posts and DMs and the app's permissions. Step-by-step guide.

Source: https://leakwatch.net/secrets/x-twitter-access-token-secret

---

[LeakWatch](/)

[Product](/product)[Live feed](/leaks)[Guides](/secrets)[Blog](/blog)[Free scan](/)

1.  [Home](/)
2.  [Secrets](/secrets)
3.  X (Twitter) Access Token and Secret

Messaging · Secret guide

# Leaked X (Twitter) Access Token and Secret: what to do in the first hour

High severityDetected onlyLast verified October 30, 2026 · 5 min read

An X access token and its access secret are a user-level credential for the X API. Used together with the app’s API key and secret to sign OAuth 1.0a requests, they let an application act as one specific X account: reading what that account can read, and, according to the permission level of the app, posting, deleting, following or sending direct messages. For a bot or a brand account, that means a stranger can publish in your name. There is no password and no second factor involved. Regenerate the token pair first, then review the account.

[Check your GitHub account for leaked secrets — free](/)

Provider

Twitter

Severity

High

Impact

SaaS account access and billing

Checked live by LeakWatch

No

## What an X access token and secret look like

The access token is the user’s numeric ID, a dash, and a random string. The access secret is a separate random string with no prefix:

```text
123456…-XXXX…   Access token: numeric user ID, a dash, then 20 to 40 letters and digits (masked)
access secret   45 characters, letters and digits (masked)
```

The number before the dash identifies the X account the token acts as, which is useful when you are looking for the right account. Typical variable names are `TWITTER_ACCESS_TOKEN`, `TWITTER_ACCESS_TOKEN_SECRET`, `X_ACCESS_TOKEN` and `X_ACCESS_TOKEN_SECRET`. Do not mix them up with the app credentials: the API key and secret identify the application, a bearer token is an app-only credential beginning with a run of `A` characters, and the pair here identifies a user authorization. A configuration file often contains all of them together, so treat the whole set as exposed.

## How X access tokens and secrets get leaked

-   **Bots and cron jobs.** A script that posts or replies automatically, with the four OAuth 1.0a values written in the source.
-   **Environment files.** `TWITTER_ACCESS_TOKEN` and its secret in a `.env` file pushed to a public repository.
-   **Developer tutorials.** The console lets you generate a token for your own account in one click, and people paste it into sample code.
-   **Notebooks and CI logs.** A data notebook saved with its cells, or a pipeline that prints its environment.
-   **Shared configuration.** A client library settings file sent in a forum post or issue to ask for help.

## What to do in the first hour

1.  **Find the app and the account.** In the X developer console, open the app the token was issued for. The number before the dash in the token tells you which X account it acts as.
2.  **Regenerate the access token and secret** from the app’s keys and tokens page. Regenerating replaces the previous pair. If the token was authorized by another person’s account (a sign-in flow), that user can also revoke the app from the connected applications in their own X settings.
3.  **Deploy the new pair** to your secret manager and services, then run a test request.
4.  **Regenerate the app’s API key and secret too** if they were stored next to the token, since the pair signs requests together. See the guide for the key and secret.
5.  **Audit the account.** Look at recent posts, replies, reposts, likes, follows and direct messages for activity you did not do. Delete unwanted posts and check the account’s profile, email and linked phone number.
6.  **Check the app’s permissions.** If it has read and write or direct message access that it does not need, lower the level and regenerate the token again so the change applies.
7.  **Clean up the code** and search the repository for other credentials. See [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github).

Not sure what else leaked from the same repository? [Run a free scan](/).

[Not sure what else leaked? Run a free scan.](/)

## Revoke it at X

Sign in to the X developer console with the account that owns the app, open the app and go to its keys and tokens tab, where the access token and secret can be regenerated. X’s general guidance is in its documentation on [OAuth 1.0a](https://docs.x.com/fundamentals/authentication/oauth-1-0a). A person has not confirmed the exact menu wording for this guide, and the console has been renamed more than once, so if the page differs, look for the section where an app’s authentication tokens are listed. Users who authorized your app can remove it themselves from the connected apps list of their X account settings.

## How LeakWatch detects it

Four rules cover this pair, all case-insensitive. “Twitter Access Token” and “Twitter Access Secret” need the word `twitter` first, then a short label of up to about 20 characters, an assignment sign (`=`, `:` or `=>`), optional quotes, and the value. “X (Twitter) Access Token” and “X (Twitter) Access Secret” need the rebranded names: `x access token` for the token and `x access token secret` for the secret, with a space, dot, dash or underscore between words, preceded by a non-word character so that names like `nginx_access` do not match. The token value is 15 to 25 digits, a dash and 20 to 40 letters or digits. The secret value is exactly 45 letters or digits. A secret of another length, or a value with no `twitter` or `x access token` name before it, is not reported. The token rules have severity **high**, and so do the secret rules. These types are not checked live: LeakWatch does not call the X API, so a hit shows the shape in context, not that the pair works.

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 access token alone enough to post?

Requests are signed with four values: the app key and secret, and the access token and secret. A leaked token without the rest is limited, but files rarely hold only one of them.

Does regenerating the token log me out of X?

No. It only invalidates the credentials of the app. Your normal X sign-in is unaffected, though an authorization from another user must be redone.

Should I change my X password?

If the token belonged to your own account and you saw activity you did not do, change the password, check connected apps and sessions, and make sure two-factor authentication is on.

## Related

-   [X (Twitter) API Key and Secret](/secrets/x-twitter-api-key-secret)
-   [X (Twitter) Bearer Token](/secrets/x-twitter-bearer-token)
-   [Discord Bot Token](/secrets/discord-bot-token)
-   [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github)
-   [Which vendors leak most this week](/leaks/trends)
-   [All secret guides](/secrets)

[Get alerted next time a secret leaks — create a free account](/)

LeakWatch is not affiliated with Twitter.

![Gabriel Diyan, founder of LeakWatch](/brand/Photo-Gabriel-Diyan.webp)

Gabriel Diyan (0xCr0c0)

Cybersecurity student, founder of LeakWatch. I built and run the scanner described here — the detection patterns, the false-positive classifier and the provider validators are mine. [More about who I am](/about).

[GitHub](https://github.com/Leakwatch-Scan) · [X](https://x.com/LeakwatchScan) · [LinkedIn](https://www.linkedin.com/in/gabriel-diyan-80a378375) · [GitHub (personal)](https://github.com/crocogab)

LeakWatch

Secrets leak into public commits every minute. This watches the forges for yours. Built and run by [Gabriel Diyan](/about), a cybersecurity student — [why LeakWatch exists](/about).

Scan

-   [Product](/product)
-   [Live feed](/leaks)
-   [Trends](/leaks/trends)
-   [API docs](/docs)
-   [CI/CD](/docs?tab=ci)

Read

-   [Blog](/blog)
-   [Secret guides](/secrets)
-   [Changelog](/changelog)
-   [About](/about)

Verify

-   [Security](/security)
-   [Privacy](/privacy)
-   [Terms](/terms)
-   [Legal](/legal)
-   [Contact](/contact)
-   [Status](https://status.leakwatch.net)

© 2026 LeakWatch

[GitHub](https://github.com/Leakwatch-Scan)[X](https://x.com/LeakwatchScan)
