Authentication & Authorization
OAuth 2.0 (Experimental)
Collection Level

Collection-Level OAuth2 Configuration

Overview

Bruno allows you to configure OAuth2 authentication at the collection level, making it reusable across all requests within that collection. This guide explains how to set up and use OAuth2 authentication effectively.

Setting Up OAuth2

  1. Access Collection Settings

    • Open your collection
    • Navigate to Collection Settings
    • Select the "Auth" tab
  2. Configure OAuth2

    • Choose "OAuth 2.0" from the authentication dropdown
    • Select your preferred grant type
    • Fill in the required OAuth2 parameters

Supported Grant Types

Bruno supports three OAuth2 grant types:

Managing Access Tokens

Generating Tokens

  1. Configure OAuth2 parameters as per grant type.
  2. You can choose where to add this token in the request by selecting the "Add token to" dropdown:
    • Headers
      • Adds the token to the request headers
      • Configure the header prefix (defaults to "Bearer")
    • URL
      • Adds the token to the request URL
      • Configure the query parameter name (defaults to "access_token")
  3. Click "Get Access Token" to obtain and store the token.

Note: You may optionally assign a Token ID to your token. If you do, you can reference this token in requests using the format {{$oauth2.tokenId.access_token}} (replace tokenId with your Token ID).

If you use the same Token ID in multiple OAuth requests, Bruno will overwrite the existing token data. Make sure to use unique Token IDs for different OAuth configurations.

Using Collection-Level OAuth2 in Requests

When a collection has OAuth2 configured, individual requests can use the authentication in two ways:

Method 1: Collection Inheritance (Recommended)

  • Open request settings
  • Select "Auth" tab
  • Choose "Inherit from collection"
  • The token will be automatically added to the request according to your collection-level configuration (Headers or URL)

Method 2: Direct Token Reference

You can manually reference the collection's OAuth2 token in your requests using the variable format {{$oauth2.tokenId.access_token}} in headers or query parameters.