Chilkat Online Tools

VB6 / 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 ChilkatHttp
Dim success As Long

Dim req As New ChilkatHttpRequest

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

Dim resp As ChilkatHttpResponse
Set resp = http.PostUrlEncoded("https://login.salesforce.com{{site}}/services/oauth2/revoke",req)
If (http.LastMethodSuccess = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Debug.Print resp.StatusCode
Debug.Print resp.BodyStr

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": [
  ]
}