Skip to content
SDETRole
SDETRole

API Testing

Auth Header Generator

Build Basic, Bearer and API key headers with cURL and Playwright.

Runs entirely in your browser No sign-up

Credentials stay in this browser tab

Encoding happens locally and nothing is stored or sent. Even so, prefer test accounts and short-lived tokens, and keep real secrets in environment variables or your CI secret store, not in test code.

Credentials

Used in the cURL and Playwright snippets.

Header

Authorization: Basic Og==

cURL

Playwright: extraHTTPHeaders

About this tool

Authentication is the first thing an API test needs and a common source of confusing 401s: a password with non-ASCII characters encoded with btoa, a token pasted with “Bearer” already in it, or an API key sent in a query string that ends up in logs. This tool builds the header for Basic auth (RFC 7617, UTF-8 encoded before Base64), Bearer tokens (RFC 6750) and API keys in a header or query parameter, and shows the matching curl command and a Playwright config using extraHTTPHeaders with secrets read from environment variables. For OAuth 2.0 client credentials it shows the token request as curl and a small Playwright helper, because that flow exchanges credentials for a token rather than sending a fixed header. Inputs are never saved or sent anywhere.

How to use it

  1. Choose the scheme: Basic, Bearer token, API key or OAuth 2.0 client credentials.
  2. Enter the credentials and the request URL. Warnings appear for common mistakes such as a colon in a Basic username or plain http://.
  3. Copy the header line, the curl command or the Playwright snippet, and move the secret into an environment variable before committing.

Auth Header Generator FAQ

Is Base64 in Basic auth a form of encryption?

No. Base64 is an encoding that anyone can reverse. Basic auth is only safe over HTTPS, and the credentials are sent with every request.

Why does btoa fail on my password?

btoa only accepts Latin-1 characters, so characters such as € or emoji throw an error. RFC 7617 recommends UTF-8, so this tool encodes the text as UTF-8 bytes first, which is what servers expecting UTF-8 will decode.

Where should test credentials live?

In environment variables or your CI secret store, never in the repository. The Playwright snippets read process.env values for that reason. Prefer dedicated test accounts with minimal permissions and short-lived tokens.

Type to search across SDETRole.

Full-text search by Pagefind · runs in your browser Open search page →