Sample code for 30+ languages & platforms
Xbase++

Generate OAuth 1.0 Signature

Demonstrates how to generate an OAuth 1.0 signature.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oOauth

nSuccess := 0

//  This example assumes the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

nSuccess := 0

oOauth := CreateObject("Chilkat.OAuth1")

//  Set input parameters:
oOauth:OauthVersion := "1.0"
oOauth:OauthMethod := "GET"
oOauth:OauthUrl := "http://echo.lab.madgex.com/echo.ashx"
oOauth:ConsumerKey := "key"
oOauth:ConsumerSecret := "secret"
oOauth:Token := "accesskey"
oOauth:TokenSecret := "accesssecret"
oOauth:Nonce := "01020304050607080102030405060708"
oOauth:Timestamp := "1441659763"
//  Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2"
oOauth:SignatureMethod := "HMAC-SHA256"

nSuccess := oOauth:Generate()
IF (nSuccess != 1)
    ? oOauth:LastErrorText
    oOauth:destroy()
    RETURN
ENDIF

//  Examine the various outputs:

? oOauth:QueryString
? oOauth:BaseString
? oOauth:HmacKey
? oOauth:Signature
? oOauth:EncodedSignature
? oOauth:AuthorizationHeader
? oOauth:GeneratedUrl

oOauth:destroy()