Guide

How to set an Authorization header in Chrome

To send Authorization: Bearer <token> from Chrome, add it as a request header in a profile that is limited to your API’s domain. Chrome then sets it on every matching page load, fetch and XHR call, without a change to your code.

Set a Bearer token in Headerbench

  1. Create a profile named Staging API. In Profile settings, tag it Staging so the popup shows which environment is on.
  2. On Request headers, add Authorization with the action Set. Open the arrow next to the value and pick Bearer token, then paste your token after Bearer .
  3. Open Filters and add an include filter of type Domain with api.staging.example.com. This keeps the token away from every other site.
  4. Optional: under Request types, choose Only these and keep Fetch / XHR, so only API calls carry the token.
  5. Open your app, turn the profile on in the popup and allow access to the API domain and your app’s page when Chrome asks.
  6. Use Test a URL with https://api.staging.example.com/v1/me to confirm the header applies.
Profile         Staging API        (env: Staging)
Request headers
  Set     Authorization      Bearer eyJhbGciOi…
  Set     X-Api-Key          test_4f9a…
Filters
  Include  Domain            api.staging.example.com
Request types   Only these: Fetch / XHR

Set replaces an Authorization header your app already sends, so you can test a different user or role without logging out.

API keys and Basic auth

An API key is just another row, for example X-Api-Key; use the header name your API documents. For a staging site behind Basic auth, pick Basic auth from the value menu, then paste the base64 of user:password after it. You can produce it with printf 'user:password' | base64. With the request type left on All types, page loads carry it too and the browser stops prompting.

Reuse one token across profiles (Pro)

Tokens expire. If several profiles use the same one, put it on the Variables page as api_token and write Bearer {{api_token}} in each profile. Change the variable once and every profile picks it up. Variables are a Pro feature; adding the first one starts a 14-day trial with no card. Without Pro, {{api_token}} is sent as written and the editor warns you. Pasting the token into each profile works fine on the free plan.

Check that it worked

Add httpbin.org as a second include filter and open httpbin.org/bearer. Without a Bearer token it answers 401; with one it returns "authenticated": true and the token it received. httpbin.org/headers shows every header. Opening a URL is a page load, so if you limited request types to Fetch / XHR, switch to All types while you check.

Chrome DevTools does not always show headers changed by an extension. If the Network panel shows the old value, trust the server’s echo or the popup’s Applied on this tab, which asks Chrome what it actually changed.

Troubleshooting

Still 401 or 403

Check for a doubled Bearer Bearer, a stray space or line break from the paste, an expired token, or a token for another environment. Test a URL shows the exact value Chrome will send.

No header at all

Chrome applies header and redirect rules only when Headerbench has access to the request’s site and to the page that sends the request, its initiator. A call to api.staging.example.com from an app on staging.example.com needs both. Without the page, Chrome skips the rule without an error. The popup shows a Grant button when the current page is missing, and Test a URL has a Sent from page field that checks the pair.

A CORS error instead of a 401

That is the API’s response headers, not your token. See how to add CORS headers for local development.

Another profile wins

If two profiles that are on set Authorization, the one higher in the popup list wins. Test a URL marks the other as overridden.

Keep tokens safe

Use test or staging credentials, not a production admin token. Headerbench keeps profiles in this browser’s extension storage. With Pro sync on, profiles and variables are also copied to Chrome’s own sync storage under your Google account; nothing goes to a Headerbench server. Exported JSON files include header values and variables, so treat an export like the token itself.

Without an extension

For calling an API directly, curl -H "Authorization: Bearer $TOKEN" or an HTTP client is enough. For browser tests, Playwright’s extraHTTPHeaders adds the header to every request. Neither changes what your app sends in your everyday browser, which is what the extension is for.

Related guides