Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test your OAuth2 secured API using DHC
{
"version": 3,
"nodes": [
{
"id": "D410754A-AEB9-47BA-8C88-D018AF5BCCFC",
"lastModified": "2016-03-17T11:12:13.759+01:00",
"name": "OAuth2 demo",
"type": "Project"
},
{
"id": "4883C3FA-2A42-4ADA-AF67-EE11484F3587",
"lastModified": "2016-03-17T11:12:13.761+01:00",
"name": "User credentials grant",
"requestOrder": [
"OAuth - Get token",
"OAuth - Use token"
],
"type": "Scenario",
"parentId": "D410754A-AEB9-47BA-8C88-D018AF5BCCFC"
},
{
"uriEditor": true,
"id": "D87B6B45-F5C6-4C78-BC8D-8F0AF4A4222C",
"lastModified": "2016-02-18T18:26:03.628+01:00",
"name": "OAuth - Get token",
"headers": [
{
"enabled": true,
"name": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
],
"assertions": [
{
"path": "code",
"value": "200",
"comparison": "Equals",
"subject": "ResponseStatus"
},
{
"path": "$.access_token",
"value": "200",
"comparison": "Exists",
"subject": "ResponseJsonBody"
}
],
"type": "Request",
"method": {
"requestBody": true,
"link": "http://tools.ietf.org/html/rfc7231#section-4.3.3",
"name": "POST"
},
"body": {
"autoSetLength": true,
"formBody": {
"overrideContentType": true,
"encoding": "application/x-www-form-urlencoded",
"items": [
{
"enabled": true,
"name": "grant_type",
"value": "password",
"type": "Text"
},
{
"enabled": true,
"name": "client_id",
"value": "demoapp",
"type": "Text"
},
{
"enabled": true,
"name": "client_secret",
"value": "demopass",
"type": "Text"
},
{
"enabled": true,
"name": "username",
"value": "demouser",
"type": "Text"
},
{
"enabled": true,
"name": "password",
"value": "testpass",
"type": "Text"
}
]
},
"bodyType": "Form"
},
"headersType": "Form",
"uri": {
"path": "brentertainment.com/oauth2/lockdin/token",
"scheme": {
"name": "http",
"version": "V11"
}
},
"parentId": "4883C3FA-2A42-4ADA-AF67-EE11484F3587"
},
{
"uriEditor": true,
"id": "AE1D5EED-1C7D-4179-AC37-5B49A52937A4",
"lastModified": "2016-03-17T11:12:13.761+01:00",
"name": "OAuth - Use token",
"headers": [
{
"enabled": true,
"name": "Authorization",
"value": "bearer {\"OAuth2 demo\".\"User credentials grant\".\"OAuth - Get token\".response.body.access_token}"
}
],
"assertions": [
{
"path": "code",
"value": "200",
"comparison": "Equals",
"subject": "ResponseStatus"
}
],
"type": "Request",
"method": {
"link": "http://tools.ietf.org/html/rfc7231#section-4.3.1",
"name": "GET"
},
"body": {
"autoSetLength": true,
"formBody": {
"overrideContentType": true,
"encoding": "application/x-www-form-urlencoded",
"items": [
{
"enabled": true,
"name": "grant_type",
"value": "password",
"type": "Text"
},
{
"enabled": true,
"name": "client_id",
"value": "demoapp",
"type": "Text"
},
{
"enabled": true,
"name": "client_secret",
"value": "demopass",
"type": "Text"
},
{
"enabled": true,
"name": "username",
"value": "demouser",
"type": "Text"
},
{
"enabled": true,
"name": "password",
"value": "testpass",
"type": "Text"
}
]
},
"bodyType": "Form"
},
"headersType": "Form",
"uri": {
"path": "brentertainment.com/oauth2/lockdin/resource",
"scheme": {
"name": "http",
"version": "V11"
}
},
"parentId": "4883C3FA-2A42-4ADA-AF67-EE11484F3587"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment