Auth component in the request pane and CollectionSettings/Auth for collection-level configuration.
Authentication Modes
Bruno supports the following authentication types, as defined inRequestPane/Auth/AuthMode:
Basic Auth
Username and password authentication using HTTP Basic Auth.
Bearer Token
Token-based authentication using the Authorization header.
OAuth 2.0
Industry-standard OAuth 2.0 with multiple grant types.
API Key
Custom API key in header, query param, or cookie.
AWS Sig v4
Amazon Web Services signature version 4 authentication.
Digest Auth
More secure alternative to Basic Auth using MD5 hashing.
NTLM Auth
Windows NT LAN Manager authentication.
WSSE Auth
WS-Security authentication for SOAP services.
Setting Authentication Mode
Authentication can be configured at three levels:- Request Level
- Folder Level
- Collection Level
Basic Authentication
TheBasicAuth component handles HTTP Basic Authentication:
Configuration
Username for authentication. Supports variable interpolation:
{{username}}Password for authentication. Supports variable interpolation:
{{password}}Example in .bru File
Using Script for Basic Auth
From the test suite (bruno-tests/collection/auth/basic/via script/Basic Auth 200.bru):
Bearer Token
TheBearerAuth component handles Bearer token authentication:
Configuration
Bearer token value. Supports variable interpolation:
{{access_token}}Example
From the test suite:bruno-tests/collection/auth/bearer/via auth/Bearer Auth 200.bru
Bearer tokens are automatically added to the
Authorization header as Bearer {token}.OAuth 2.0
TheOAuth2 component provides comprehensive OAuth 2.0 support with multiple grant types:
Grant Types
TheGrantTypeSelector component supports four grant types:
- Password Credentials
- Implicit
- Client Credentials
OAuth 2.0 Configuration Options
Where to send client credentials:
body: In request body (default)header: In Authorization header
Where to include the access token:
header: Authorization header (default)query: Query parameter
Prefix for token in Authorization header (e.g., “Bearer”, “Token”)
Query parameter name when tokenPlacement is “query”
OAuth 2.0 Example
API Key Authentication
TheApiKeyAuth component allows flexible API key placement:
Configuration
API key parameter name (e.g., “X-API-Key”, “api_key”)
API key value. Supports variables:
{{api_key}}Where to send the API key:
header: HTTP headerquery: Query parametercookie: Cookie
Examples
AWS Signature v4
TheAwsV4Auth component provides AWS authentication:
Configuration
AWS Access Key ID. Use
{{aws_access_key_id}} for security.AWS Secret Access Key. Use
{{aws_secret_access_key}} for security.Optional session token for temporary credentials.
AWS service name (e.g., “s3”, “execute-api”, “lambda”).
AWS region (e.g., “us-east-1”, “eu-west-1”).
Example
Digest Authentication
TheDigestAuth component provides more secure authentication than Basic Auth:
Configuration
Username for Digest authentication
Password for Digest authentication
Example
NTLM Authentication
TheNTLMAuth component provides Windows NTLM authentication:
Configuration
Windows username (may include domain: DOMAIN\username)
Windows password
Example
WSSE Authentication
TheWsseAuth component provides WS-Security authentication:
Configuration
WSSE username
WSSE password
Authentication Inheritance
Bruno supports authentication inheritance through the collection hierarchy:Inheritance Example
Collection Structure
collection.bru:
Using Variables for Security
Environment Variables
Environment Variables
Store sensitive credentials in environment variables:
environments/production.json
.gitignore Environments
.gitignore Environments
Add environment files to
.gitignore to prevent committing secrets:.gitignore
Runtime Variable Setting
Runtime Variable Setting
Use pre-request scripts to fetch tokens dynamically:
Best Practices
Use Inheritance
Use Inheritance
Configure auth at the collection or folder level to avoid duplication and ensure consistency.
Store Secrets Securely
Store Secrets Securely
Never hardcode credentials. Use
{{variables}} that reference environment-specific values.Rotate Tokens in Scripts
Rotate Tokens in Scripts
For OAuth 2.0, use post-response scripts to capture and store new access tokens automatically.
Test Auth Failures
Test Auth Failures
Create separate requests to test 401/403 responses with invalid credentials.
Document Required Scopes
Document Required Scopes
Use the Docs tab to document which OAuth scopes or API key permissions are needed.
Next Steps
Scripts
Learn how to automate auth token refresh with scripts
Collection Settings
Configure collection-level authentication
Environment Variables
Manage auth credentials across environments
Tests
Write tests to validate authentication