Coder Social home page Coder Social logo

dimns / insomnia-plugin-get-access-token Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jdinicola/insomnia-plugin-get-access-token

0.0 0.0 0.0 67 KB

Insomnia plugin to get an access token from authorization URL and save it as a template variable

License: MIT License

JavaScript 100.00%

insomnia-plugin-get-access-token's Introduction

Get Access Token

Overview

This plugin simply makes a request to an authorization endpoint, extracts the access token from the response body using JSONPath or from a response header. Then saves it as template variable, so you can use it anywhere (environment, requests, etc.).

This was inspired on Swagger's "Authorize" button.

Installation

One-Click installation

  1. Go to http://insomnia.rest/plugins/insomnia-plugin-get-access-token
  2. Click the "Install plugin" button.
  3. Click "Open Insomnia" and "Install"

Install from plugins tab

  1. Open Insomnia
  2. Go to Application > Preferences > Plugins
  3. Enter insomnia-plugin-get-access-token
  4. Click "Install Plugin"

Manual installation

  1. Open Insomnia plugins folder on a terminal window
  2. git clone https://github.com/jdinicola/insomnia-plugin-get-access-token
  3. cd insomnia-plugin-get-access-token
  4. npm install

Usage

Create an authorization request, add it the TokenResponseHeader header with the name of the response header that contains the token or the JSONPath-filter header with the filter value (JSONPath notation).

Examples:

// Using response TokenResponseHeader
Content-Length  36
Content-Type    application/json
Access-token    abcdef1234
...

// TokenResponseHeader would be "Access-token"
// Using JSONPath-filter
{
  "status": 200,
  "error": false,
  "body": {
    "access_token": "abcdef1234"
  },
  ...
}

// JSONPath-filter would be "$.body.access_token"
// Go to https://goessner.net/articles/JsonPath/ for a complete reference on JSONPath

After this, click on the authorization request actions (arrow on right) and click on "Authorize requests" option.

Request action

This creates a access_token template variable that you can use on environment, request URL, request header, etc.

Template variable

Contributing

Contributions, issues and feature requests are welcome. Feel free to open an issue or create a pull request.


Padlock icon by Icons8

insomnia-plugin-get-access-token's People

Contributors

jdinicola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.