Hi,
I'm trying to develop algorithm for twitter API - for creating signature: https://dev.twitter.com/oauth/overview/creating-signatures
Do we have something for twitter like this, or is there any macro to calculate HMAC-SHA1 other than calling external program?
Thank you
Martin
Solved! Go to Solution.
I have been working on some custom .Net tools, one of them includes exposing the various hash algorithms.
See https://github.com/jdunkerley/AlteryxAddIns/blob/master/AlteryxAddIns/HashingTool.cs
Hoping to get this released next week, you are welcome to use it.
Hi Martin,
I'm guessing you may want to do a little more than the in-built twitter tool in Alteryx, hence why you are doing it manually, but you can open that tool up and see how the Authentication is done... just be careful not to save over the top of it. There is also an Oauth Macro on the Engine Works Blog which may give you some ideas.
Kane
Yes good point Kane,
I've done this. But in-build twitter tool in Alteryx uses only an application-level authorization, not the one with tokens for access home timeline etc. If I'm right.
OAuth works well. But it seems like twitter API need to have every request signed by relatively easy but long algorithm with SHA1.
Now I'm using 3rd party tool for accessing twitter, maybe it is the easiest way.
Martin
I've encountered this same issue and resolved it using the Alteryx R Tool. The package 'digest' contains function hmac() to calculate HMAC-SHA1.
Im using following - but im not sure if it is right.. (Im not R person), please correct me if not
package_name <- "digest" # grab the alteryx repo altx.repo <- getOption("repos") altx.repo["CRAN"] <- "http://cran.rstudio.com" # set your primary repo if you haven't already options(repos = altx.repo) #check to see if the package we want is already installed # if it is, we will just load it, otherwise we will install it if(package_name %in% rownames(installed.packages())==FALSE){ install.packages(package_name) } require(package_name, character.only=TRUE) data <- read.Alteryx("#1", mode="data.frame") f <- function(x, output) { hash <- x[1] base <- x[2] output <- hmac(hash, base, "sha1") } current <- apply(data, 1, f, output = 'outputfile') write.Alteryx(current, 1)
Thanks, Martin.
I'm definitely not an R person either, but it seems to be the only way to sign a WebService request with SHA1 hashing. I'll see if I'm able to make use of this.
Regards,
Taylor
This is very similar to what I was trying to do. I guess my problem is that I also don't understand the HMAC usage. For instance, I'm trying to call Adobe Marketing Cloud API endpoints. Their documentation requires that I send (in headers) a Nonce (via the UuidCreate() function), a Created timestamp, and a Digest. The digest is the SHA1 hash of the Nonce + Created + SecretKey (concatenated). So where I am a bit lost is in the HMAC function in R, what is the 'Hash' and what is the 'Base' that I feed the function?
Any insights?
You are welcome to try my addins. It will take a string and create SHA-1 for it.
Need installed but can download newest version from https://github.com/jdunkerley/AlteryxAddIns/releases/tag/v0.3
Demo workflow attached.