Skip to main content

HTTP Basic Authentication

k6 supports HTTP Basic Auth in two ways:
1

Using URL credentials

Pass username and password directly in the URL:
2

Using Authorization header

Manually create the Authorization header:

HTTP Digest Authentication

For Digest Auth, pass credentials in the URL and add the auth: "digest" option:
The auth: "digest" parameter tells k6 to use Digest authentication instead of Basic.

JWT Authentication

Create and verify JWT tokens using k6’s crypto module:
This example shows how to create, sign, and verify JWT tokens entirely within k6 without external libraries.