# A Mastercard Plugin for Insomnia REST Client source: https://developer.mastercard.com/blog/a-mastercard-plugin-for-insomnia-rest-client/index.md Authors: Jie Zhang. Insomnia is a popular open-source REST client application that works on Windows, Mac and Linux. It is a handy tool for developers to test API calls by simply filling in the parameters without writing any code. Insomnia offers a set of authentication methods out of box. However, at Mastercard, we are using OAuth 1.0a with SHA2 body hash for authentication. Due to this fact, it is not so straightforward to use the tool as-is to make calls to Mastercard APIs. In order to make our developers' life easier, I decided to extend the Insomnia app to support Mastercard authentication method. Initially, I forked the Insomnia GitHub repository and implemented our authentication method directly in the application itself. It was working perfectly fine. But, users would need to install a custom version of the app. It was also difficult to maintain as we needed to constantly merge from upstream whenever the official Insomnia app releases a new version. I later started exploring the possibility of developing a plugin instead. Basically, I needed to create a plugin to calculate the Authorization header based on the request before it's sent. Insomnia provides a Request Hook API which allows me to get the request details in order for my plugin to calculate the header. However, earlier versions of the Request Hook API didn't expose the request parameters to the plugins which became a blocker. Fortunately, I discovered that someone was also looking for this feature and even submitted a pull request. I sent a message to the author of Insomnia on GitHub hoping he could approve the pull request and expedite this feature. He was very responsive and released it in the next version v5.15.0 -- the power of open source community! Developing the plugin was fairly simple. Below is a flow of what the plugin does for each request: Use the Request Hook API to get the full URL of the request including parameters, if any. Check if the request's target host is a Mastercard API. Skip the flow if it's not, so that the plugin won't affect requests that are not Mastercard APIs. Read API key information from the current Insomnia environment variables. Calculate the OAuth cryptographic signature using Mastercard API Core SDK. Add the signature in the Authorization header to the current request. If you are interested, you may find the plugin source repository in our Mastercard GitHub account. The plugin is published to NPM for distribution. You can install the official Insomnia application (v5.15.0 and above). Within the Insomnia application, install the plugin insomnia-plugin-mastercard-auth and configure the Mastercard API keys in the environment variable. You are now ready to play around with Mastercard APIs. Follow this detailed step-by-step tutorial to try it yourself!