Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Visual FoxPro Examples

Web API Categories

ASN.1
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks

Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
NTLM
OAuth1
OAuth2
Office365
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Visual FoxPro) ABN AMRO OAuth2 Client Credentials Authentication

Demonstrates how to obtain an access token for an ABN AMRO online API using OAuth2 with the Client Credentials flow.

For more information, see https://developer.abnamro.com/api/payment-initiation-v1/payment-initiation-tutorial

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loCert
LOCAL lnSuccess
LOCAL loBdKey
LOCAL loPrivKey
LOCAL loHttp
LOCAL loReq
LOCAL loResp
LOCAL loJson

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

* This example sends the following CURL request:

* 	curl -X POST -k https://auth-sandbox.connect.abnamro.com:8443/as/token.oauth2 \
* 	-v \
* 	--cert TPPCertificate.crt \
* 	--key TPPprivateKey.key \
* 	-H 'Cache-Control: no-cache' \
* 	-H 'Content-Type: application/x-www-form-urlencoded' \
* 	-d 'grant_type=client_credentials&client_id=TPP_test&scope=psd2:payment:sepa:write psd2:payment:sepa:read'

loCert = CreateObject('Chilkat_9_5_0.Cert')
lnSuccess = loCert.LoadFromFile("qa_data/certs/TPPCertificate.cer")
IF (lnSuccess <> 1) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    CANCEL
ENDIF

loBdKey = CreateObject('Chilkat_9_5_0.BinData')
lnSuccess = loBdKey.LoadFile("qa_data/certs/TPPprivateKey.key")

loPrivKey = CreateObject('Chilkat_9_5_0.PrivateKey')
lnSuccess = loPrivKey.LoadAnyFormat(loBdKey,"passwordIfNeeded")
IF (lnSuccess <> 1) THEN
    ? loPrivKey.LastErrorText
    RELEASE loCert
    RELEASE loBdKey
    RELEASE loPrivKey
    CANCEL
ENDIF

lnSuccess = loCert.SetPrivateKey(loPrivKey)
IF (lnSuccess <> 1) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    RELEASE loBdKey
    RELEASE loPrivKey
    CANCEL
ENDIF

loHttp = CreateObject('Chilkat_9_5_0.Http')

lnSuccess = loHttp.SetSslClientCert(loCert)
IF (lnSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loCert
    RELEASE loBdKey
    RELEASE loPrivKey
    RELEASE loHttp
    CANCEL
ENDIF

loReq = CreateObject('Chilkat_9_5_0.HttpRequest')
loReq.AddParam("grant_type","client_credentials")
loReq.AddParam("client_id","TPP_test")
loReq.AddParam("scope","psd2:payment:sepa:write psd2:payment:sepa:read")

loResp = loHttp.PostUrlEncoded("https://auth-sandbox.connect.abnamro.com:8443/as/token.oauth2",loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loCert
    RELEASE loBdKey
    RELEASE loPrivKey
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

IF (loResp.StatusCode <> 200) THEN
    ? loResp.BodyStr
    RELEASE loResp
    RELEASE loCert
    RELEASE loBdKey
    RELEASE loPrivKey
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

* Get the JSON result:
* {"access_token":"TIhycwl8rfrZPkXGw15mwldASAAK","token_type":"Bearer","expires_in":7200}
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.Load(loResp.BodyStr)
? "access_token: " + loJson.StringOf("access_token")
? "token_type: " + loJson.StringOf("token_type")
? "expires_in: " + loJson.StringOf("expires_in")

RELEASE loResp

RELEASE loCert
RELEASE loBdKey
RELEASE loPrivKey
RELEASE loHttp
RELEASE loReq
RELEASE loJson


 

© 2000-2020 Chilkat Software, Inc. All Rights Reserved.