This Bruno collection demonstrates how to use the jsonwebtoken library inside Bruno to generate and verify JWT tokens, improving your API testing workflow.
- Generate JWT access tokens using
jsonwebtokenlibrary - Automatically set tokens in Bruno environment variables
- Verify tokens and inspect payloads in Bruno's DevTools console
- Streamlined authentication testing workflow
Use the "Fetch in Bruno" button to directly import this collection into your Bruno app:
git clone https://github.com/bruno-collections/jsonwebtoken.git
cd jsonwebtokenAfter fetching or cloning the collection, install the required dependencies:
-
Open your terminal in the directory where you saved this collection
-
Install dependencies:
npm install
This will install:
express- Web framework for the demo serverjsonwebtoken- JWT generation and verification library
- Open Bruno and load the collection
- Navigate to the test request in the collection
- Click "Send" to execute the request
After executing the request, you will see:
- ✅ Access token automatically set in Bruno's environment variables
- ✅ Token verification output in Bruno's DevTools console
- ✅ Decoded payload displayed for inspection
The generated access token is now available as an environment variable and can be used in subsequent requests:
{{accessToken}}
To see the verification and debugging output:
- Open Bruno DevTools (View → Toggle DevTools or
Cmd/Ctrl + Shift + I) - Go to the Console tab
- Execute your request
- View the decoded token payload and verification results
jsonwebtoken/
├── bruno.json # Bruno collection configuration
├── test.bru # Main test request with JWT scripts
├── environments/
│ └── env.bru # Environment variables
├── package.json # Node.js dependencies
└── README.md # This file
The collection includes Bruno scripts for:
- Pre-request Script: Generate JWT token before request execution
- Post-response Script: Verify and decode received tokens
- Tests: Validate token structure and expiration
- Bruno Documentation
- jsonwebtoken NPM Package
- JWT.io - JWT token debugger
Feel free to submit issues and enhancement requests!
Happy Testing with Bruno! 🚀