Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

oAuth Signature - Invalid Signature

amitbanwar
7 - Meteor

Hi All,

 

I am trying to connect to Alteryx API via visual basic. 

 

I am facing issues in creating oAuth Signature. It giving me an error - invalid signature.

 

Please find below the code being used to generate the signature. 

 

Function CreateNewSignature(strUrl As String, getpost As String, strSecret As String, Nonce As String, Time As String, strKey As String)
'''''Each call to the server need a signature. The signature uses a secret to encode a number of combined fields. The secret is not passed to the server. The server
'''''already has the secret and uses it to decode the combined fields to verify your identity. This function is called by SetupAlteryxUrl.
dim strBaseString
strBaseString = HttpUtility.UrlEncode(strUrl) & _
"&oauth_consumer_key%3D" & strKey & _
"%26oauth_nonce%3D" & Nonce & _
"%26oauth_signature_method%3DHMAC-SHA1" & _
"%26oauth_timestamp%3D" & Time & _
"%26oauth_version%3D1.0"

CreateNewSignature = Base64_HMACSHA1_1(UCase(getpost) & "&" & strBaseString, strSecret & "&")

End Function

 

Public Function Base64_HMACSHA1_1(ByVal sTextToHash As String, ByVal sSharedSecretKey As String)
'''''This actually generates the signature. It's called by the function CreateNewSignature.

'Using this base string, we then encrypt the data using a composite of the secret keys and the HMAC-SHA1 algorithm.
Dim compositeKey As String = Uri.EscapeDataString(sSharedSecretKey)
Dim oauth_signature As String

Dim hasher As HMACSHA1 = New HMACSHA1(ASCIIEncoding.ASCII.GetBytes(compositeKey))
Using hasher
oauth_signature = Convert.ToBase64String(hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes(sTextToHash)))
End Using

Base64_HMACSHA1_1= oauth_signature

End Function

 

Kindly assist with your input.

1 REPLY 1
rkapoor
Alteryx
Alteryx

@amitbanwar 

 

What version of Visual Basic are you using? I have a feeling this is an issue on the VB side. 

 

Microsoft had this issue in 2018, and I am wondering if you upgrade VB, this might not occur.