npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

insomnia-plugin-response-extensions

v1.0.1

Published

Reference values (such as headers or OAuth2 token) from other request's responses - extensions

Readme

Insomnia response extensions template tag

Npm Version

This simple community plugin adds a template tag which makes it possible to reference additional attributes of another request's response in environmental variables.

Response plugin from base Insomnia package supports only basic attributes: body, raw body, header, request URL. Install this extension if you want to access additional info such as OAuth2 tokens or response headers.

Installation

Install package from npm:

  1. Go to Application -> Preferences -> Plugins.
  2. Type insomnia-plugin-response-extensions as npm-package-name and click Install Plugin.

Usage

Response extensions template tag makes it easy to define common response-based settings in the global, per environment or per folder scope.

Add a tag:

{
    "AccessToken": "{% responseExtensions 'req_cadf591fbdda4d5eb42f2625eddbbaec', 'oauth2', '$.accessToken' %}"
}

where:

  • request_id - ID of the source request, e.g.: req_20958b46132f4296ae6d8d4748fa6b84
  • attribute - attributes of the response: oauth2|response
  • filter - JSONPath filter of the object associated with particular attribute, e.g.: $.accessToken for OAuth2

Or, configure in the visual editor:

Sample image


Supported attributes/filters

Below the list of supported attributes and their filters. You can always type $ as a filter to see the object associated with the selected attribute.

  • oauth2 - OAuth2 token details. Applies to requests with OAuth 2.0 authentication selected

    • type - OAuth2Token
    • parentId - ID of the selected request, e.g. req_20958b46132f4296ae6d8d4748fa6b84
    • modified
    • created
    • expiresAt
    • refreshToken
    • accessToken
    • identityToken
    • xResponseId
    • xError
    • error
    • errorDescription
    • errorUri
    • _id
  • response - response details and metadata

    • _id
    • type
    • parentId
    • modified
    • created
    • statusCode
    • statusMessage
    • httpVersion
    • contentType
    • url
    • bytesRead
    • bytesContent
    • elapsedTime
    • headers
    • timelinePath
    • bodyPath
    • bodyCompression
    • error
    • requestVersionId
    • settingStoreCookies
    • settingSendCookies
    • environmentId

Primary use case - reusing OAuth2 token from another request

I wrote this extension because I wanted to reuse the same authentication token between multiple requests. Without going into details, I couldn't simply obtain the authorization code so I decided to take advantage of built-in support for OAuth2 flow which does let me to get the access token I needed. With this extended response template tag, you can perform more advanced requests chaning to for example simplify authentication settings on global level.

With base Insomnia, you can do this for current request, but not for any other. This feature has been requested previously:

  • https://github.com/Kong/insomnia/discussions/3694
  • https://github.com/Kong/insomnia/issues/1116

Here's how to use the tag for this purpose:

  1. Define a request that you will use to fetch/refresh the access token. Configure it to use OAuth2.

This is the only place you need to configure the OAuth2 details such as for example client credentials.

  1. Configure an environment variable to reference the token

Sample image

You can do it in your base environment, on a sub environment or even on a folder level:

Sample image

This is especially handy if you have a collection that consists of multiple folders, where each of them reaches a different service and you need to provide different credentials for each.

Directory tree:

|_ Folder A
    |_ Request 1
    |_ Request 2
    |_ __auth
|_ Folder B
    |_ Request 3
    |_ Request 4
    |_ __auth
  1. Configure the bearer token on your requests:

Sample image

Now you can utilize Insomnia's built-in OAuth2 mechanisms and have your requests chained. No need to configure every single request with detailed OAuth2 settings nor to copy-paste anything.

License and support

This plugin is licensed under the MIT license.

If you've found a bug or have a feature request, feel free to open an issue: https://github.com/vajsm/insomnia-plugin-response-extensions/issues

If you use and like the extension, please give it a star, so that I know there are people out there who may appreciate new features! Thanks :)

GitHub repository: https://github.com/vajsm/insomnia-plugin-response-extensions