If you are sick of expired authentication tokens when running multiple requests in insomnia then try to use this plugin.
Another approach to solve this task is using insomnia chaining requests. However in that case you will need to configure tag with auth response data for every request you are running.
Now, the parameters you are using to get your application token might be different,
but you can implement it using this sample as an example.
This plugin fetches auth token based on values configured in insomnia environment variables
and adds it to the request header in the format of Authorization: bearer <FETCHED AUTH TOKEN>
.
If your insomnia request already has Authorization header plugin WILL NOT override it so you are flexible there...
Compulsory environment variables used by this insomnia plugin are:
{
"url": "",
"client_id": "",
"client_secret": "",
"password": "",
"username": ""
}
- Checkout this repository;
- run
npm i
- Copy source code to insomnia plugins directory(see paths below);
- Create environment variables(see structure above) with your values;
-
MacOS: ~/Library/Application\ Support/Insomnia/plugins/
-
Windows: %APPDATA%\Insomnia\plugins\
-
Linux: $XDG_CONFIG_HOME/Insomnia/plugins/ or ~/.config/Insomnia/plugins/
- Write Tests
- Publish plugin to npm