Created
October 15, 2024 03:51
-
-
Save DinoChiesa/1e81bfd1dea9e1b04c697e849ae1961f to your computer and use it in GitHub Desktop.
Postman collection for the OAuthV2 Client Credentials example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "ac53fc95-c464-4413-8330-0ae96d1bfd1e", | |
"name": "OAuth2 Client Credentials", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | |
"_exporter_id": "22976572" | |
}, | |
"item": [ | |
{ | |
"name": "Request-for-Token (Client credentials", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = JSON.parse(responseBody);", | |
"", | |
"pm.environment.set(\"access_token\", jsonData.access_token);", | |
"" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"auth": { | |
"type": "basic", | |
"basic": [ | |
{ | |
"key": "username", | |
"value": "client-id", | |
"type": "string" | |
}, | |
{ | |
"key": "password", | |
"value": "client-secret", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "urlencoded", | |
"urlencoded": [ | |
{ | |
"key": "grant_type", | |
"value": "client_credentials", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "{{endpoint}}/oauth2-cc/token", | |
"host": [ | |
"{{endpoint}}" | |
], | |
"path": [ | |
"oauth2-cc", | |
"token" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Request with no Authorization", | |
"request": { | |
"method": "GET", | |
"header": [], | |
"url": { | |
"raw": "{{endpoint}}/loopback-1/t1", | |
"host": [ | |
"{{endpoint}}" | |
], | |
"path": [ | |
"loopback-1", | |
"t1" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Request with Authorization Header", | |
"request": { | |
"auth": { | |
"type": "oauth2", | |
"oauth2": [ | |
{ | |
"key": "tokenType", | |
"value": "", | |
"type": "string" | |
}, | |
{ | |
"key": "accessToken", | |
"value": "{{access_token}}", | |
"type": "string" | |
}, | |
{ | |
"key": "addTokenTo", | |
"value": "header", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "GET", | |
"header": [], | |
"url": { | |
"raw": "{{endpoint}}/loopback-1/t1", | |
"host": [ | |
"{{endpoint}}" | |
], | |
"path": [ | |
"loopback-1", | |
"t1" | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment