AppInspected

Fix guides

There's a Slack token in your website's code. Revoke it before someone reads your workspace.

Last reviewed November 12, 2026 against the providers' current documentation.

The short version

Revoke the token now with Slack's auth.revoke method: send a request to https://slack.com/api/auth.revoke with the leaked token in the Authorization: Bearer header. Revoking a bot token doesn't uninstall the app; you get a new token by going through the app's install (OAuth) flow again. Then, if you're on a paid Slack plan, read your workspace's Access logs for app activity you don't recognise. Move the Slack calls your page made into server code that reads the new token from a server-only environment variable, and turn on Slack's Restrict API Token Usage IP allowlist for the app.

Why it matters

Slack's security docs say to "never place them in a public code repository or client-side code". A Slack token is a key to your workspace with whatever scopes the app was given. A bot token (xoxb-) with channels:history can read the messages in every public channel the app was added to; with chat:write it can post as your bot, which is an easy way to send phishing links to your team from an account they trust. A user token (xoxp-) acts as the person who installed the app, so it can see what that person can see. Slack's token docs give expiry times only for workflow tokens and for apps that opted in to token rotation, so assume a token from a normal app keeps working until it's revoked.

Fix it, in this order

  1. Work out which token it is

    The prefix tells you. xoxb- is a bot token, tied to your installed app. xoxp- is a user token, acting as the workspace member who authorized the app. A token that starts with xoxe. comes from an app with token rotation turned on and expires 12 hours after it was issued, but its refresh token (xoxe-1-…) can mint new ones, so if that is anywhere in your code too, treat it as just as serious. Our check also flags other xox prefixes from older Slack apps. Search your code for where it came from, usually a VITE_SLACK_TOKEN, VITE_SLACK_BOT_TOKEN or NEXT_PUBLIC_ variable. To confirm which workspace and bot or user it belongs to, call auth.test with it; it needs no scopes and returns the team and user.
  2. Revoke it

    Call auth.revoke with the leaked token, for example curl -X POST https://slack.com/api/auth.revoke -H "Authorization: Bearer xoxb-…". Slack's docs say to use it when you no longer need a token or want to reset its value. For a bot token, revoking deactivates the bot user and removes it from its channels, but doesn't uninstall the app. You get a fresh token by running the app's OAuth install flow again. For an app with token rotation, auth.revoke revokes one token without changing the installation, so revoke the leaked access token and stop using the leaked refresh token.
  3. Check what the token did

    On Pro and Business+ plans, an owner or admin can open Admin → Workspace settings → Security → Access logs; Slack's help says entries are created when members act through an app or bot on their behalf, with the IP address and device. Enterprise plans open it under Tools & settings → Workspace settings and Slack recommends the access logs API there for complete data. Also look in the channels your bot could post to for messages you didn't send, and warn your team if you find links they might have clicked. Free plans don't have access logs, so assume anything the token's scopes allowed may have been read.
  4. Move Slack calls to a server

    The browser should never hold a Slack token. Put each call behind a small server endpoint (an API route, a Server Action, a Supabase Edge Function, a Cloudflare Worker) that reads the token from a server-only environment variable, requires a logged-in user where it can, checks the input (for example only lets the page post to one channel, with plain text) and rate-limits requests. Slack recommends storing tokens server-side and never hardcoding them in your source code.
  5. Lock down the new token

    Give the reinstalled app only the scopes the feature uses: a "post to one channel" feature needs chat:write, not channels:history or user scopes. In the app's settings, OAuth & Permissions → Restrict API Token Usage lets you list up to 20 allowed IP addresses or ranges, and Slack then rejects Web API calls from anywhere else. That only works if your server has fixed outgoing IPs, and it doesn't cover incoming webhooks. Consider turning on token rotation (also under OAuth & Permissions) so access tokens expire every 12 hours; note that Slack says rotation can't be turned off once it's on.
  6. Clean up the old copies

    Remove the token from your .env files and source, rebuild and deploy, then run the check again. Old builds stay in browser caches, CDN caches and web archives, which is why revoking comes first.

Or ask your AI tool to do it

Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.

My website's frontend JavaScript contains a Slack token (it starts with xoxb-, xoxp- or xoxe.). Find every place the token is defined or read, including .env files and any VITE_, NEXT_PUBLIC_, REACT_APP_ or EXPO_PUBLIC_ variable, and every place that calls the Slack API (@slack/web-api, fetch calls to slack.com/api, chat.postMessage, conversations.history and so on). List what each call does. Remove every Slack token from client-side code and move each call into a server-side endpoint (API route, server action, Supabase Edge Function or serverless function) that reads the token from a server-only environment variable. The endpoint must not let the browser choose the channel, the Slack method or raw message blocks: for a feedback or contact form, post the visitor's text as plain text to one fixed channel. Validate input, rate-limit by IP and user, and add a CAPTCHA to public forms. Tell me the minimum Slack scopes the server needs. Finally, remind me to revoke the old token with auth.revoke and reinstall the app to get a new one.

How this happens

Usually a feedback widget, contact form, waitlist or "notify me in Slack when someone signs up" feature that an AI coding tool wired up from the page. The Slack SDK wants a token, so the tool puts the bot token in a VITE_ or NEXT_PUBLIC_ variable to get rid of an undefined error, and that copies it into the JavaScript every visitor downloads. Often the browser call is blocked anyway, but the token is still sitting in the bundle.

Check that it's really fixed

After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.

Topic check: Exposed API key checker

Find the other leaks before someone else does

The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.

$19 once, including 20 runs over 30 days so you can fix things and check again.

Get the report, $19 See an example report

Example report header: a score out of 100, findings by severity, Download PDF and Email me this report.

Questions

Will Slack revoke the token for me?

Don't count on it. Slack's incoming webhooks page says Slack "actively searches out and revokes leaked secrets", but its token and security docs don't say Slack looks for tokens in deployed websites. Revoke it yourself with auth.revoke.

My bot can only post messages. Is that still a problem?

Yes. Anyone with the token can post as your bot, in the channels it can reach, to people who trust it: a classic way to spread phishing links inside a company. It also uses your app's rate limits. Revoke it and keep the new token on a server.

What about Slack incoming webhook URLs (hooks.slack.com)?

Slack says a webhook URL "contains a secret" and shouldn't be shared online. A webhook can only post to the one channel it was created for, as your app, so it's less powerful than a bot token, but it can still be used to post spam or phishing into that channel. The free check looks for xox tokens, not webhook URLs, so search your built JavaScript for hooks.slack.com yourself, and send webhook posts from your server too.

Can I make a Slack token safe to use in the browser?

No. Anything in your JavaScript can be copied. Slack's IP allowlist helps once the token is on your server, but a browser has no fixed IP. If users need to act on their own Slack accounts, use Slack's OAuth flow with your app's client secret kept on the server.

Does your check try the token?

No. The free check is passive: it finds xoxb-, xoxp- and other xox tokens in your page and its JavaScript, shows them cut short, and never sends them to Slack. Only auth.test and your workspace's logs can tell you whether the token is still active and what it did.

Sources

Related guides