Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loJsonFormData1
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest')
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/oauth/v2/token/revoke"
loReq.ContentType = "multipart/form-data"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonFormData1 = CreateObject('Chilkat.JsonObject')
loReq.AddStringForUpload2("token","",loJsonFormData1,"utf-8","application/json")
loResp = loHttp.SynchronousRequest("domain.com",443,1,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loReq
RELEASE loJsonFormData1
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loReq
RELEASE loJsonFormData1
Curl Command
curl -X POST
--form 'token={{refresh-token}}'
https://domain.com/oauth/v2/token/revoke
Postman Collection Item JSON
{
"name": "Revoking Tokens",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (responseCode.code === 200)",
"{",
" var jsonData = JSON.parse(responseBody);",
" ",
" if (jsonData.status == \"sucess\")",
" {",
" pm.environment.set(\"refresh-token\", \"\");",
" pm.environment.set(\"access-token\", \"\");",
" pm.environment.set(\"expiry-time\", \"\");",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "token",
"value": "{{refresh-token}}",
"type": "text"
}
]
},
"url": {
"raw": "{{accounts-domain}}/oauth/v2/token/revoke",
"host": [
"{{accounts-domain}}"
],
"path": [
"oauth",
"v2",
"token",
"revoke"
]
},
"description": "### Step 5: Revoking Tokens\n\nIn case if you wish to revoke the refresh_token, use the below approach."
},
"response": [
]
}