How to add an Authorization header in Chrome
Chrome has no setting for adding an Authorization header to the requests a page makes. You need an extension that can edit headers. In HeaderDial you add a request header named Authorization with the value Bearer <token>, limit it to your API's domain, and optionally give it an expiry so it turns off when the token runs out. The same steps work in Microsoft Edge.
When you need this
- You want to open a protected API endpoint in the browser and read the JSON without writing a client.
- A front end under development calls an API that expects a token the app cannot get yet, for example because the login flow isn't built.
- You are testing how a page behaves for a different user or role and have that user's token.
- A staging server sits behind HTTP Basic auth and you don't want the browser's login prompt on every visit.
The two common formats
| Scheme | Header value | Notes |
|---|---|---|
| Bearer | Bearer eyJhbGciOi... | OAuth 2.0 access tokens, JWTs, most API keys issued as tokens. The word Bearer, one space, then the token. |
| Basic | Basic dXNlcjpwYXNzd29yZA== | Base64 of username:password. This is encoding, not encryption: anyone who sees the header can decode it. Only use it over HTTPS. |
To produce a Basic value in a terminal:
printf '%s' 'user:password' | base64
# dXNlcjpwYXNzd29yZA==
Steps
- Click the HeaderDial icon in the toolbar to open the popup. If you see the site-access banner, choose Allow on all sites or Only <current host>. Without site access the browser does not let any extension change headers.
- Click + Request header. Type
Authorizationin the name field (it is in the suggestions) and pasteBearerfollowed by a space and your token into the value field. Leave the operation on set, which replaces any Authorization header the page would send. - If the token is short-lived, pick a time in the expiry select: 15 min, 1 hour, 8 hours or 1 day. The row shows the time remaining, such as
⏱ 47m left, and the header switches itself off when the time is up. This stops a stale token from producing confusing 401 errors later, and it means a token doesn't keep being sent after you've moved on. - Open Where it applies. It says "all sites" until you add a filter. Click + Only on…, choose Domain and enter your API host, for example
api.example.com. If you are on that site already, the + Only on <current host> button does the same in one click. - Reload the page. The footer shows "Applied to N requests in this tab", and the toolbar badge shows how many headers are active.
Check it in DevTools
Open DevTools (F12), go to the Network panel, reload, select a request to your API and look under Request Headers. To see exactly what the server received, call an endpoint that echoes request headers back. If the API answers 401, check the server log for the header too. A typo in the scheme (bearer vs Bearer) or a stray line break pasted with the token is a common cause. HeaderDial rejects values that contain line breaks and shows a problem message.
The curl equivalent
curl -H "Authorization: Bearer $TOKEN" https://api.example.com/v1/me
# Basic auth: let curl build the header
curl -u user:password https://staging.example.com/
Pitfalls
- Header values are stored in your browser profile. HeaderDial keeps them in local extension storage and makes no network requests of its own. However, Export all and Export this profile write the token into the file. When you use Share as link…, tick Leave header values empty so a colleague gets the header name and filters but not your credentials.
- Prefer test tokens. Use a token for a test account or one with limited scope rather than a production admin credential.
- Cookies may win. Some back ends check a session cookie before the Authorization header. If you appear as the wrong user, try a private window with HeaderDial allowed there, or log out first.
- Two profiles, one header. If two active profiles both set Authorization, the leftmost profile chip wins. Use Move left (higher priority) in the ⋯ menu to reorder them.
Add to ChromeFirefox: coming soon