HeaderDial › Guides

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

The two common formats

SchemeHeader valueNotes
BearerBearer eyJhbGciOi...OAuth 2.0 access tokens, JWTs, most API keys issued as tokens. The word Bearer, one space, then the token.
BasicBasic 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

  1. 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.
  2. Click + Request header. Type Authorization in the name field (it is in the suggestions) and paste Bearer followed by a space and your token into the value field. Leave the operation on set, which replaces any Authorization header the page would send.
  3. 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.
  4. 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.
  5. 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

Always add a filter. With no "Only on" filter a header applies to every request on every site, so your token would be sent to every server the browser talks to, including third-party scripts and analytics hosts.

Add to ChromeFirefox: coming soon