Created
October 4, 2022 14:18
-
-
Save dylanyoung-dev/8aa265cdc5c2d51810663886db3fd112 to your computer and use it in GitHub Desktop.
Collection of oAuth authentication methods for Sitecore CDP/Personalize.
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": "e445a895-2163-4019-9770-7c53eddcf3e6", | |
"name": "oAuth Authentication", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | |
"_exporter_id": "18869027" | |
}, | |
"item": [ | |
{ | |
"name": "Authenticate", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = JSON.parse(responseBody);\r", | |
"postman.setEnvironmentVariable(\"AdminToken\", jsonData.access_token);" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"auth": { | |
"type": "basic", | |
"basic": [ | |
{ | |
"key": "username", | |
"value": "{{ClientKey}}", | |
"type": "string" | |
}, | |
{ | |
"key": "password", | |
"value": "{{ApiToken}}", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "urlencoded", | |
"urlencoded": [ | |
{ | |
"key": "grant_type", | |
"value": "client_credentials", | |
"type": "text" | |
}, | |
{ | |
"key": "ClientKey", | |
"value": "{{ClientKey}}", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "https://{{apiEndpoint}}/v2/oauth/token", | |
"protocol": "https", | |
"host": [ | |
"{{apiEndpoint}}" | |
], | |
"path": [ | |
"v2", | |
"oauth", | |
"token" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Create Token", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = JSON.parse(responseBody);\r", | |
"postman.setEnvironmentVariable(\"AdminToken\", jsonData.access_token);\r", | |
"postman.setEnvironmentVariable(\"RefreshToken\", jsonData.refresh_token);" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"protocolProfileBehavior": { | |
"disabledSystemHeaders": { | |
"accept": true, | |
"accept-encoding": true, | |
"connection": true | |
} | |
}, | |
"request": { | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "urlencoded", | |
"urlencoded": [ | |
{ | |
"key": "username", | |
"value": "{{Username}}", | |
"type": "text" | |
}, | |
{ | |
"key": "password", | |
"value": "{{Password}}", | |
"type": "text" | |
}, | |
{ | |
"key": "grant_type", | |
"value": "password", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "https://{{apiEndpoint}}/v2/oauth/token", | |
"protocol": "https", | |
"host": [ | |
"{{apiEndpoint}}" | |
], | |
"path": [ | |
"v2", | |
"oauth", | |
"token" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Refresh Token", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = JSON.parse(responseBody);\r", | |
"postman.setEnvironmentVariable(\"AdminToken\", jsonData.access_token);\r", | |
"postman.setEnvironmentVariable(\"RefreshToken\", jsonData.refresh_token);" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "urlencoded", | |
"urlencoded": [ | |
{ | |
"key": "refresh_token", | |
"value": "{{RefreshToken}}", | |
"type": "text" | |
}, | |
{ | |
"key": "grant_type", | |
"value": "refresh_token", | |
"type": "text" | |
}, | |
{ | |
"key": "clientKey", | |
"value": "{{ClientKey}}", | |
"type": "text" | |
}, | |
{ | |
"key": "code", | |
"value": "", | |
"type": "text", | |
"disabled": true | |
} | |
] | |
}, | |
"url": { | |
"raw": "https://{{apiEndpoint}}/v2/oauth/token", | |
"protocol": "https", | |
"host": [ | |
"{{apiEndpoint}}" | |
], | |
"path": [ | |
"v2", | |
"oauth", | |
"token" | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment