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
(PureBasic) Generate OAuth 1.0 SignatureDemonstrates how to generate an OAuth 1.0 signature.
IncludeFile "CkOAuth1.pb" IncludeFile "CkGlobal.pb" Procedure ChilkatExample() oauth.i = CkOAuth1::ckCreate() If oauth.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; All Chilkat classes can be unlocked at once at the beginning of a program ; by calling UnlockBundle. It requires a Bundle unlock code. chilkatGlob.i = CkGlobal::ckCreate() If chilkatGlob.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = CkGlobal::ckUnlockBundle(chilkatGlob,"Anything for 30-day trial.") If success <> 1 Debug CkGlobal::ckLastErrorText(chilkatGlob) CkOAuth1::ckDispose(oauth) CkGlobal::ckDispose(chilkatGlob) ProcedureReturn EndIf ; Set input parameters: CkOAuth1::setCkOauthVersion(oauth, "1.0") CkOAuth1::setCkOauthMethod(oauth, "GET") CkOAuth1::setCkOauthUrl(oauth, "http://echo.lab.madgex.com/echo.ashx") CkOAuth1::setCkConsumerKey(oauth, "key") CkOAuth1::setCkConsumerSecret(oauth, "secret") CkOAuth1::setCkToken(oauth, "accesskey") CkOAuth1::setCkTokenSecret(oauth, "accesssecret") CkOAuth1::setCkNonce(oauth, "01020304050607080102030405060708") CkOAuth1::setCkTimestamp(oauth, "1441659763") ; Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2" CkOAuth1::setCkSignatureMethod(oauth, "HMAC-SHA256") success = CkOAuth1::ckGenerate(oauth) If success <> 1 Debug CkOAuth1::ckLastErrorText(oauth) CkOAuth1::ckDispose(oauth) CkGlobal::ckDispose(chilkatGlob) ProcedureReturn EndIf ; Examine the various outputs: Debug CkOAuth1::ckQueryString(oauth) Debug CkOAuth1::ckBaseString(oauth) Debug CkOAuth1::ckHmacKey(oauth) Debug CkOAuth1::ckSignature(oauth) Debug CkOAuth1::ckEncodedSignature(oauth) Debug CkOAuth1::ckAuthorizationHeader(oauth) Debug CkOAuth1::ckGeneratedUrl(oauth) CkOAuth1::ckDispose(oauth) CkGlobal::ckDispose(chilkatGlob) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.