Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Isabel Connect Revoke Access TokenSee more Ibanity ExamplesRevokes an access token. For more information, see https://documentation.ibanity.com/isabel-connect/api#revoke-refresh-token
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Variant vCert Handle hoCert Boolean iSuccess Variant vReq Handle hoReq Handle hoJsonToken Variant vResp Handle hoResp Variant vSbResponseBody Handle hoSbResponseBody Integer iRespStatusCode String sTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // // Implements the following CURL command: // // curl -X POST https://api.ibanity.com/isabel-connect/oauth2/revoke \ // --cert certificate.pem:qwertyuiop1 \ // --key private_key.pem \ // -H "Content-Type: application/x-www-form-urlencoded" \ // -H "Accept: application/vnd.api+json" \ // -d token=8787 \ // -d client_id=valid_client_id \ // -d client_secret=valid_client_secret // Ibanity provides the certificate + private key in PFX format. This example will use the .pfx instead of the pair of PEM files. // (It is also possible to implement using Chilkat with the PEM files, but PFX is easier.) Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadPfxFile Of hoCert "qa_data/pfx/my_ibanity_certificate.pfx" "my_pfx_password" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End Get pvComObject of hoCert to vCert Get ComSetSslClientCert Of hoHttp vCert To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatHttpRequest)) To hoReq If (Not(IsComObjectCreated(hoReq))) Begin Send CreateComObject of hoReq End Set ComHttpVerb Of hoReq To "POST" Set ComPath Of hoReq To "/isabel-connect/oauth2/revoke" Set ComContentType Of hoReq To "application/x-www-form-urlencoded" // Load the previously obtained access token. Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken If (Not(IsComObjectCreated(hoJsonToken))) Begin Send CreateComObject of hoJsonToken End Get ComLoadFile Of hoJsonToken "qa_data/tokens/isabel_access_token.json" To iSuccess If (iSuccess = False) Begin Showln "No existing access token." Procedure_Return End Get ComStringOf Of hoJsonToken "access_token" To sTemp1 Send ComAddParam To hoReq "token" sTemp1 // Note: For sandbox testing, we literally want to use the strings // "valid_client_id", and "valid_client_secret". // For the live app, you would replace these with actual values. Send ComAddParam To hoReq "client_id" "valid_client_id" Send ComAddParam To hoReq "client_secret" "valid_client_secret" Send ComAddHeader To hoReq "Accept" "application/vnd.api+json" Get pvComObject of hoReq to vReq Get ComPostUrlEncoded Of hoHttp "https://api.ibanity.com/isabel-connect/oauth2/revoke" vReq To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody If (Not(IsComObjectCreated(hoSbResponseBody))) Begin Send CreateComObject of hoSbResponseBody End Get pvComObject of hoSbResponseBody to vSbResponseBody Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess Get ComStatusCode Of hoResp To iRespStatusCode Showln "Response Status Code = " iRespStatusCode If (iRespStatusCode >= 400) Begin Showln "Response Header:" Get ComHeader Of hoResp To sTemp1 Showln sTemp1 Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp Showln "Response Body:" Get ComGetAsString Of hoSbResponseBody To sTemp1 Showln sTemp1 // If successful, the response status code = 200, and the response body is "{}" End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.