![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Node.js) curl Update Local Manager SecretsSee more CURL ExamplesDemonstrates 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.
var os = require('os'); if (os.platform() == 'win32') { var chilkat = require('@chilkat/ck-node23-win64'); } else if (os.platform() == 'linux') { if (os.arch() == 'arm') { var chilkat = require('@chilkat/ck-node23-linux-arm'); } else if (os.arch() == 'arm64') { var chilkat = require('@chilkat/ck-node23-linux-arm64'); } else { var chilkat = require('@chilkat/ck-node23-linux-x64'); } } else if (os.platform() == 'darwin') { var chilkat = require('@chilkat/ck-node23-mac-universal'); } function chilkatExample() { var success = false; // 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 var secrets = new chilkat.Secrets(); var json = new chilkat.JsonObject(); json.UpdateString("appName","sharepoint"); json.UpdateString("service","oauth2"); json.UpdateString("username","client_id"); // These are not actual/real values.. success = secrets.UpdateSecretStr(json,"4afc67c5-6d3f-4ed0-91c7-5d239c78bff7"); if (success == false) { console.log(secrets.LastErrorText); return; } json.UpdateString("username","client_secret"); success = secrets.UpdateSecretStr(json,"Rlh8Q~xaP10Dw-goWQDLXrRJfYAFVW1hHauvfhO6"); if (success == false) { console.log(secrets.LastErrorText); return; } json.UpdateString("username","token_endpoint"); success = secrets.UpdateSecretStr(json,"https://login.microsoftonline.com/5f410b89-177f-40b3-9d66-ac519c728025/oauth2/v2.0/token"); if (success == false) { console.log(secrets.LastErrorText); return; } // ----------------------------------------------------------------------------------------------------------- // The above secrets would be accessed like this: var json2 = new chilkat.JsonObject(); json2.EnableSecrets = true; // Chilkat sees the secret specification string (beginning with "!!") and resolves from the local manager. json2.UpdateString("x","!!sharepoint|oauth2|client_id"); console.log("x = " + json2.StringOf("x")); json2.UpdateString("y","!!sharepoint|oauth2|client_secret"); console.log("y = " + json2.StringOf("y")); json2.UpdateString("z","!!sharepoint|oauth2|token_endpoint"); console.log("z = " + json2.StringOf("z")); // 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 } chilkatExample(); |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.