Skip to content

Commit 6390c92

Browse files
authored
Merge pull request #9 from jaaufauvre/master
Improved README.md
2 parents d1f5a98 + 57bf492 commit 6390c92

File tree

1 file changed

+59
-11
lines changed

1 file changed

+59
-11
lines changed

README.md

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,70 @@
11
# insomnia-plugin-mastercard-auth
22

3-
Mastercard API authentication plugin for Insomnia REST Client.
3+
[![](https://img.shields.io/npm/v/insomnia-plugin-mastercard-auth.svg)](https://www.npmjs.com/package/insomnia-plugin-mastercard-auth)
4+
[![](https://img.shields.io/badge/license-Apache%202.0-yellow.svg)](https://github.com/Mastercard/insomnia-plugin-mastercard-auth/blob/master/LICENSE)
45

5-
## Installation
6+
## Table of Contents
7+
- [Overview](#overview)
8+
* [Compatibility](#compatibility)
9+
* [References](#references)
10+
- [Usage](#usage)
11+
* [Prerequisites](#prerequisites)
12+
* [Installation](#installation)
13+
* [Configuration](#configuration)
14+
* [Authenticated Requests](#authenticated-requests)
15+
- [Further Reading](#further-reading)
616

7-
Install the `insomnia-plugin-mastercard-auth` plugin from Preferences > Plugins.
17+
## Overview <a name="overview"></a>
18+
A plugin for handling Mastercard API authentication. This plugin computes and adds an `Authorization` header to requests sent from [Insomnia REST Client](https://insomnia.rest/).
819

9-
## Usage
20+
### Compatibility <a name="compatibility"></a>
21+
Insomnia v5.15.0+
1022

11-
Add Mastercard API keys by setting a `mastercard` environment variable.
23+
### References <a name="references"></a>
24+
* [Using OAuth 1.0a to Access Mastercard APIs](https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/)
25+
* [A Mastercard Plugin for Insomnia REST Client](https://developer.mastercard.com/blog/a-mastercard-plugin-for-insomnia-rest-client)
26+
27+
## Usage <a name="usage"></a>
28+
29+
### Prerequisites <a name="prerequisites"></a>
30+
Before using this library, you will need to set up a project in the [Mastercard Developers Portal](https://developer.mastercard.com).
31+
32+
As part of this set up, you'll receive credentials for your app:
33+
* A consumer key (displayed on the Mastercard Developer Portal)
34+
* A private request signing key (matching the public certificate displayed on the Mastercard Developer Portal)
35+
36+
### Installation <a name="installation"></a>
37+
38+
1. Open Insomnia
39+
2. Go to Application > Preferences > Plugins
40+
3. Type "insomnia-plugin-mastercard-auth"
41+
4. Click "Install Plugin"
42+
43+
![installing-mastercard-plugin](https://user-images.githubusercontent.com/3964455/66712914-d291e000-ed9b-11e9-8b1f-7246b83f8b83.gif)
44+
45+
### Configuration <a name="configuration"></a>
46+
47+
Update your [environment](https://support.insomnia.rest/article/18-environment-variables):
48+
1. Click "Manage Environments"
49+
2. Create a "mastercard" environment variable with your credentials:
1250

1351
```json
1452
{
15-
"mastercard": {
16-
"consumerKey": "[YOUR CONSUMER KEY]",
17-
"keyAlias": "[YOUR KEY ALIAS]",
18-
"keystoreP12Path": "[YOUR KEYSTORE .P12 PATH]",
19-
"keystorePassword": "[YOUR KEYSTORE PASSWORD]"
20-
}
53+
"mastercard": {
54+
"consumerKey": "000000000000000000000000000000000000000000000000!000000000000000000000000000000000000000000000000",
55+
"keyAlias": "keyalias",
56+
"keystoreP12Path": "/path/to/sandbox-signing-key.p12",
57+
"keystorePassword": "keystorepassword"
58+
}
2159
}
2260
```
61+
![updating-environment](https://user-images.githubusercontent.com/3964455/66712916-d32a7680-ed9b-11e9-934b-4aaddc418dff.gif)
62+
63+
### Authenticated Requests <a name="authenticated-requests"></a>
64+
From now on, an `Authorization` header will be automatically added to every request sent to Mastercard:
65+
66+
![authenticated-requests](https://user-images.githubusercontent.com/3964455/66712915-d32a7680-ed9b-11e9-8047-7571be2d3cd8.gif)
67+
68+
## Further Reading <a name="further-reading"></a>
69+
* [Insomnia Plugins](https://support.insomnia.rest/article/26-plugins)
70+
* [oauth1-signer-nodejs](https://github.com/Mastercard/oauth1-signer-nodejs) — A zero dependency library for generating a Mastercard API compliant OAuth signature

0 commit comments

Comments
 (0)