Skip to content

bruno-collections/jsonwebtoken

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT Testing with Bruno

This Bruno collection demonstrates how to use the jsonwebtoken library inside Bruno to generate and verify JWT tokens, improving your API testing workflow.

🚀 Features

  • Generate JWT access tokens using jsonwebtoken library
  • Automatically set tokens in Bruno environment variables
  • Verify tokens and inspect payloads in Bruno's DevTools console
  • Streamlined authentication testing workflow

📦 Setup

Method 1: Fetch in Bruno (Recommended)

Use the "Fetch in Bruno" button to directly import this collection into your Bruno app:

Fetch in Bruno

Method 2: Manual Git Clone

git clone https://github.com/bruno-collections/jsonwebtoken.git
cd jsonwebtoken

🔧 Installation

After fetching or cloning the collection, install the required dependencies:

  1. Open your terminal in the directory where you saved this collection

  2. Install dependencies:

    npm install

    This will install:

    • express - Web framework for the demo server
    • jsonwebtoken - JWT generation and verification library

🎯 Usage

Step 1: Start Testing

  1. Open Bruno and load the collection
  2. Navigate to the test request in the collection
  3. Click "Send" to execute the request

Step 2: Observe the Results

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

Step 3: Access the Token

The generated access token is now available as an environment variable and can be used in subsequent requests:

{{accessToken}}

🔍 Viewing Console Output

To see the verification and debugging output:

  1. Open Bruno DevTools (View → Toggle DevTools or Cmd/Ctrl + Shift + I)
  2. Go to the Console tab
  3. Execute your request
  4. View the decoded token payload and verification results

📚 Collection Structure

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

🛠️ Available Scripts

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

📖 Learn More

🤝 Contributing

Feel free to submit issues and enhancement requests!

Happy Testing with Bruno! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published