Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaJavaScriptNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples
Web API Categories

AI
ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
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)
JavaScript
MHT / HTML Email
MIME
Markdown
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
Regular Expressions
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) curl Update Local Manager Secrets

See more CURL Examples
Demonstrates how to initially write secrets to the local manager that will later be used in curl commands. On Windows, this refers to the Windows Credential Manager, and on macOS, it refers to the Apple Keychain.

Note: This example requires Chilkat v11.5.0 or greater.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoSecrets
    Variant vJson
    Handle hoJson
    Variant vJson
2    Handle hoJson2
    String sTemp1

    Move False To iSuccess

    // This example will store 3 secrets in the local manager.

    // On Windows, this refers to the Windows Credential Manager, and on macOS, it refers to the Apple Keychain.
    // These secrets will be used at a later point in time in curl commands,
    // as shown in this example:  Using Local Manager Secrets with curl

    // Also see: Chilkat v11.5.0 — Secrets Integration
    // and also: Chilkat Secrets API

    Get Create (RefClass(cComChilkatSecrets)) To hoSecrets
    If (Not(IsComObjectCreated(hoSecrets))) Begin
        Send CreateComObject of hoSecrets
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End

    Get ComUpdateString Of hoJson "appName" "sharepoint" To iSuccess
    Get ComUpdateString Of hoJson "service" "oauth2" To iSuccess
    Get ComUpdateString Of hoJson "username" "client_id" To iSuccess

    // These are not actual/real values..
    Get pvComObject of hoJson to vJson
    Get ComUpdateSecretStr Of hoSecrets vJson "4afc67c5-6d3f-4ed0-91c7-5d239c78bff7" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoSecrets To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComUpdateString Of hoJson "username" "client_secret" To iSuccess
    Get pvComObject of hoJson to vJson
    Get ComUpdateSecretStr Of hoSecrets vJson "Rlh8Q~xaP10Dw-goWQDLXrRJfYAFVW1hHauvfhO6" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoSecrets To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComUpdateString Of hoJson "username" "token_endpoint" To iSuccess
    Get pvComObject of hoJson to vJson
    Get ComUpdateSecretStr Of hoSecrets vJson "https://login.microsoftonline.com/5f410b89-177f-40b3-9d66-ac519c728025/oauth2/v2.0/token" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoSecrets To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // -----------------------------------------------------------------------------------------------------------
    // The above secrets would be accessed like this:
    Get Create (RefClass(cComChilkatJsonObject)) To hoJson2
    If (Not(IsComObjectCreated(hoJson2))) Begin
        Send CreateComObject of hoJson2
    End

    Set ComEnableSecrets Of hoJson2 To True

    // Chilkat sees the secret specification string (beginning with "!!") and resolves from the local manager.
    Get ComUpdateString Of hoJson2 "x" "!!sharepoint|oauth2|client_id" To iSuccess
    Get ComStringOf Of hoJson2 "x" To sTemp1
    Showln "x = " sTemp1

    Get ComUpdateString Of hoJson2 "y" "!!sharepoint|oauth2|client_secret" To iSuccess
    Get ComStringOf Of hoJson2 "y" To sTemp1
    Showln "y = " sTemp1

    Get ComUpdateString Of hoJson2 "z" "!!sharepoint|oauth2|token_endpoint" To iSuccess
    Get ComStringOf Of hoJson2 "z" To sTemp1
    Showln "z = " sTemp1

    // You can see the values retrieved from the local manager:

    // x = 4afc67c5-6d3f-4ed0-91c7-5d239c78bff7
    // y = Rlh8Q~xaP10Dw-goWQDLXrRJfYAFVW1hHauvfhO6
    // z = https://login.microsoftonline.com/5f410b89-177f-40b3-9d66-ac519c728025/oauth2/v2.0/token


End_Procedure

 

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