ERROR!
------------------- GenerateCode ----------------------
ImpliedContentType: application/x-www-form-urlencoded
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.
new Http http;
ckbool success;
new HttpRequest req;
new JsonObject jsonParam1;
call req.AddParam("token",jsonParam1.Emit());
new HttpResponse resp;
req.HttpVerb = "POST";
req.ContentType = "application/x-www-form-urlencoded";
success = http.PostUrlEncoded("https://login.salesforce.com{{site}}/services/oauth2/revoke", req,resp);
if (success == ckfalse) {
println http.LastErrorText;
return;
}
println resp.StatusCode;
println resp.BodyStr;
---- end chilkat script ----
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_JsonParam1
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_JsonParam1 = create oleobject
li_rc = loo_JsonParam1.ConnectToNewObject("Chilkat.JsonObject")
loo_Req.AddParam("token",loo_JsonParam1.Emit())
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
loo_Req.HttpVerb = "POST"
loo_Req.ContentType = "application/x-www-form-urlencoded"
ERROR: Assignment type mismatch. ExpressionType=HttpResponse, atgType=ckbool
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
destroy loo_JsonParam1
destroy loo_Resp
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Http
destroy loo_Req
destroy loo_JsonParam1
destroy loo_Resp
Curl Command
curl -X POST
--data-urlencode 'token={{_accessToken}}'
https://login.salesforce.com{{site}}/services/oauth2/revoke
Postman Collection Item JSON
{
"name": "Revoke Token",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "token",
"value": "{{_accessToken}}",
"description": "Replace with a valid access token or refresh token. ",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}{{site}}/services/oauth2/revoke",
"host": [
"{{url}}{{site}}"
],
"path": [
"services",
"oauth2",
"revoke"
]
},
"description": "This calls the standard revoke endpoint, passing in your access token. This endpoint should be called as part of your logout process to invalidate the access and refresh token. "
},
"response": [
]
}