Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
ImpliedContentType: application/x-www-form-urlencoded
explicitContentType: 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 ----

Xojo / Salesforce Platform APIs / Revoke Token

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim http As New Chilkat.Http
Dim success As Boolean

Dim req As New Chilkat.HttpRequest

Dim jsonParam1 As New Chilkat.JsonObject
req.AddParam "token",jsonParam1.Emit()

Dim resp As New Chilkat.HttpResponse
req.HttpVerb = "POST"
req.ContentType = "application/x-www-form-urlencoded"
ERROR: Assignment type mismatch.  ExpressionType=HttpResponse, atgType=ckbool

If (success = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

System.DebugLog(Str(resp.StatusCode))
System.DebugLog(resp.BodyStr)

Curl Command

curl -X POST
	-H "Content-Type: application/x-www-form-urlencoded"
	--data-urlencode 'token={{_accessToken}}'
https://login.salesforce.com{{site}}/services/oauth2/revoke

Postman Collection Item JSON

{
  "name": "Revoke Token",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "auth": {
      "type": "noauth"
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/x-www-form-urlencoded"
      }
    ],
    "body": {
      "mode": "urlencoded",
      "urlencoded": [
        {
          "key": "token",
          "value": "{{_accessToken}}",
          "description": "If an access token is included, Salesforce invalidates it and revokes the token. If a refresh token is included, Salesforce revokes it and any associated access tokens.",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{url}}{{site}}/services/oauth2/revoke",
      "host": [
        "{{url}}{{site}}"
      ],
      "path": [
        "services",
        "oauth2",
        "revoke"
      ]
    }
  },
  "response": [
    {
      "name": "Successful Revoke Token",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/x-www-form-urlencoded"
          }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "token",
              "value": "{{_accessToken}}",
              "description": "If an access token is included, Salesforce invalidates it and revokes the token. If a refresh token is included, Salesforce revokes it and any associated access tokens.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{url}}{{site}}/services/oauth2/revoke",
          "host": [
            "{{url}}{{site}}"
          ],
          "path": [
            "services",
            "oauth2",
            "revoke"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "plain",
      "header": [
        {
          "key": "Date",
          "value": "Thu, 16 Nov 2023 15:53:04 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Content-Security-Policy",
          "value": "upgrade-insecure-requests"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        },
        {
          "key": "Set-Cookie",
          "value": "sdtsvalid=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; secure"
        },
        {
          "key": "Set-Cookie",
          "value": "setupprofileobjectsandtabsgt=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; secure"
        },
        {
          "key": "Set-Cookie",
          "value": "unifiedsearchgt=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; secure"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": null
    }
  ]
}