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
(C) Generate OAuth 1.0 SignatureDemonstrates how to generate an OAuth 1.0 signature.
#include <C_CkOAuth1.h> #include <C_CkGlobal.h> void ChilkatSample(void) { HCkOAuth1 oauth; HCkGlobal chilkatGlob; BOOL success; oauth = CkOAuth1_Create(); // All Chilkat classes can be unlocked at once at the beginning of a program // by calling UnlockBundle. It requires a Bundle unlock code. chilkatGlob = CkGlobal_Create(); success = CkGlobal_UnlockBundle(chilkatGlob,"Anything for 30-day trial."); if (success != TRUE) { printf("%s\n",CkGlobal_lastErrorText(chilkatGlob)); CkOAuth1_Dispose(oauth); CkGlobal_Dispose(chilkatGlob); return; } // Set input parameters: CkOAuth1_putOauthVersion(oauth,"1.0"); CkOAuth1_putOauthMethod(oauth,"GET"); CkOAuth1_putOauthUrl(oauth,"http://echo.lab.madgex.com/echo.ashx"); CkOAuth1_putConsumerKey(oauth,"key"); CkOAuth1_putConsumerSecret(oauth,"secret"); CkOAuth1_putToken(oauth,"accesskey"); CkOAuth1_putTokenSecret(oauth,"accesssecret"); CkOAuth1_putNonce(oauth,"01020304050607080102030405060708"); CkOAuth1_putTimestamp(oauth,"1441659763"); // Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2" CkOAuth1_putSignatureMethod(oauth,"HMAC-SHA256"); success = CkOAuth1_Generate(oauth); if (success != TRUE) { printf("%s\n",CkOAuth1_lastErrorText(oauth)); CkOAuth1_Dispose(oauth); CkGlobal_Dispose(chilkatGlob); return; } // Examine the various outputs: printf("%s\n",CkOAuth1_queryString(oauth)); printf("%s\n",CkOAuth1_baseString(oauth)); printf("%s\n",CkOAuth1_hmacKey(oauth)); printf("%s\n",CkOAuth1_signature(oauth)); printf("%s\n",CkOAuth1_encodedSignature(oauth)); printf("%s\n",CkOAuth1_authorizationHeader(oauth)); printf("%s\n",CkOAuth1_generatedUrl(oauth)); CkOAuth1_Dispose(oauth); CkGlobal_Dispose(chilkatGlob); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.