Chilkat Online Tools

Swift3 / EPC 2.0 - Partner Sandbox - 19.4 November [External] / [Partner] Introspect Partner Authentication Token

Back to Collection Items

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

    let http = CkoHttp()!
    var success: Bool

    http.basicAuth = true
    http.login = "username"
    http.password = "password"

    let req = CkoHttpRequest()!

    let jsonParam1 = CkoJsonObject()!
    req.addParam("token", value: jsonParam1.emit())

    var resp: CkoHttpResponse? = http.postUrlEncoded("https://domain.com/", req: req)
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("\(resp!.statusCode.intValue)")
    print("\(resp!.bodyStr!)")
    resp = nil

}

Curl Command

curl -X POST
	-u 'username:password'
	-H "Content-Type: application/x-www-form-urlencoded"
	--data-urlencode 'token={{partner_token}}'
https://domain.com/

Postman Collection Item JSON

{
  "name": "[Partner] Introspect Partner Authentication Token",
  "event": [
    {
      "listen": "test",
      "script": {
        "id": "7252b9c5-c9f3-49bc-a6a9-30e20a9cde88",
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "_postman_id": "e405d16f-5325-4ea7-ab00-ff6b2688bb9e",
  "request": {
    "auth": {
      "type": "basic",
      "basic": {
        "username": "{{partner_client_id}}",
        "password": "{{partner_client_secret}}",
        "showPassword": false
      }
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "type": "text",
        "value": "application/x-www-form-urlencoded"
      }
    ],
    "body": {
      "mode": "urlencoded",
      "urlencoded": [
        {
          "key": "token",
          "value": "{{partner_token}}",
          "type": "text"
        }
      ]
    },
    "url": "{{api_host}}/oauth2/v1/token/introspection"
  },
  "response": [
  ]
}