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
(SQL Server) Generate OAuth 1.0 SignatureDemonstrates how to generate an OAuth 1.0 signature.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) DECLARE @oauth int -- Use "Chilkat_9_5_0.OAuth1" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.OAuth1', @oauth OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- All Chilkat classes can be unlocked at once at the beginning of a program -- by calling UnlockBundle. It requires a Bundle unlock code. DECLARE @chilkatGlob int -- Use "Chilkat_9_5_0.Global" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Global', @chilkatGlob OUT DECLARE @success int EXEC sp_OAMethod @chilkatGlob, 'UnlockBundle', @success OUT, 'Anything for 30-day trial.' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @chilkatGlob, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @oauth EXEC @hr = sp_OADestroy @chilkatGlob RETURN END -- Set input parameters: EXEC sp_OASetProperty @oauth, 'OauthVersion', '1.0' EXEC sp_OASetProperty @oauth, 'OauthMethod', 'GET' EXEC sp_OASetProperty @oauth, 'OauthUrl', 'http://echo.lab.madgex.com/echo.ashx' EXEC sp_OASetProperty @oauth, 'ConsumerKey', 'key' EXEC sp_OASetProperty @oauth, 'ConsumerSecret', 'secret' EXEC sp_OASetProperty @oauth, 'Token', 'accesskey' EXEC sp_OASetProperty @oauth, 'TokenSecret', 'accesssecret' EXEC sp_OASetProperty @oauth, 'Nonce', '01020304050607080102030405060708' EXEC sp_OASetProperty @oauth, 'Timestamp', '1441659763' -- Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2" EXEC sp_OASetProperty @oauth, 'SignatureMethod', 'HMAC-SHA256' EXEC sp_OAMethod @oauth, 'Generate', @success OUT IF @success <> 1 BEGIN EXEC sp_OAGetProperty @oauth, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @oauth EXEC @hr = sp_OADestroy @chilkatGlob RETURN END -- Examine the various outputs: EXEC sp_OAGetProperty @oauth, 'QueryString', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'BaseString', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'HmacKey', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'Signature', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'EncodedSignature', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'AuthorizationHeader', @sTmp0 OUT PRINT @sTmp0 EXEC sp_OAGetProperty @oauth, 'GeneratedUrl', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @oauth EXEC @hr = sp_OADestroy @chilkatGlob END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.