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
(Unicode C) Generate OAuth 1.0 SignatureDemonstrates how to generate an OAuth 1.0 signature.
#include <C_CkOAuth1W.h> #include <C_CkGlobalW.h> void ChilkatSample(void) { HCkOAuth1W oauth; HCkGlobalW chilkatGlob; BOOL success; oauth = CkOAuth1W_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 = CkGlobalW_Create(); success = CkGlobalW_UnlockBundle(chilkatGlob,L"Anything for 30-day trial."); if (success != TRUE) { wprintf(L"%s\n",CkGlobalW_lastErrorText(chilkatGlob)); CkOAuth1W_Dispose(oauth); CkGlobalW_Dispose(chilkatGlob); return; } // Set input parameters: CkOAuth1W_putOauthVersion(oauth,L"1.0"); CkOAuth1W_putOauthMethod(oauth,L"GET"); CkOAuth1W_putOauthUrl(oauth,L"http://echo.lab.madgex.com/echo.ashx"); CkOAuth1W_putConsumerKey(oauth,L"key"); CkOAuth1W_putConsumerSecret(oauth,L"secret"); CkOAuth1W_putToken(oauth,L"accesskey"); CkOAuth1W_putTokenSecret(oauth,L"accesssecret"); CkOAuth1W_putNonce(oauth,L"01020304050607080102030405060708"); CkOAuth1W_putTimestamp(oauth,L"1441659763"); // Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2" CkOAuth1W_putSignatureMethod(oauth,L"HMAC-SHA256"); success = CkOAuth1W_Generate(oauth); if (success != TRUE) { wprintf(L"%s\n",CkOAuth1W_lastErrorText(oauth)); CkOAuth1W_Dispose(oauth); CkGlobalW_Dispose(chilkatGlob); return; } // Examine the various outputs: wprintf(L"%s\n",CkOAuth1W_queryString(oauth)); wprintf(L"%s\n",CkOAuth1W_baseString(oauth)); wprintf(L"%s\n",CkOAuth1W_hmacKey(oauth)); wprintf(L"%s\n",CkOAuth1W_signature(oauth)); wprintf(L"%s\n",CkOAuth1W_encodedSignature(oauth)); wprintf(L"%s\n",CkOAuth1W_authorizationHeader(oauth)); wprintf(L"%s\n",CkOAuth1W_generatedUrl(oauth)); CkOAuth1W_Dispose(oauth); CkGlobalW_Dispose(chilkatGlob); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.