Hey guys, I'm trying to figure out the oAuth process using coldfusion, and there is not much information on the forums.
I keep getting "401 Unauthorized - Invalid Signature." Missing oauth_signature is invalid "But I pass the correct one.
Here is my process. ::
I am using oauth codebase from http://oauth.googlecode.com/svn/code/coldfusion/oauth
Using the examples for twitter and google, I changed it to work as shown below.
<cfset sConsumerKey = "XXX">
<cfset sConsumerSecret = "YYY">
<cfset sTokenEndpoint = "http://vimeo.com/oauth/request_token">
<cfset oReqSigMethodSHA = CreateObject("component", "oauth.oauthsignaturemethod_hmac_sha1")>
<cfset oToken = CreateObject("component", "oauth.oauthtoken").createEmptyToken()>
<cfset oConsumer = CreateObject("component", "oauth.oauthconsumer").init(sKey = sConsumerKey, sSecret = sConsumerSecret)>
<cfset myParams = structNew() />
<cfset myParams.oauth_callback = "http://XXX.XXX/web/oAuth/examples_external/vimeo2.cfm" />
<cfset oReq = CreateObject("component", "oauth.oauthrequest").fromConsumerAndToken(
oConsumer = oConsumer,
oToken = oToken,
sHttpMethod = "GET",
sHttpURL = sTokenEndpoint,
stParameters = myParams)>
<cfset oReq.signRequest(
oSignatureMethod = oReqSigMethodSHA,
oConsumer = oConsumer,
oToken = oToken)>
<cfhttp url="#oREQ.getString()#" method="get" result="tokenResponse"/>
Then oauth_token and oauth_verifier are returned.
<cfset sConsumerKey = "XXX">
<cfset sConsumerSecret = "YYY">
<cfset sAuthorizationEndpoint = "http://vimeo.com/oauth/access_token">
<cfset oReqSigMethodSHA = CreateObject("component", "oauth.oauthsignaturemethod_hmac_sha1")>
<cfset oToken = CreateObject("component", "oauth.oauthtoken").createEmptyToken()>
<cfset oConsumer = CreateObject("component", "oauth.oauthconsumer").init(sKey = sConsumerKey, sSecret = sConsumerSecret)>
<cfset myParams = structNew() />
<cfset myParams.oauth_token = URL.oauth_token />
<cfset myParams.oauth_verifier = URL.oauth_verifier />
<cfset myParams.oauth_callback = "oob" />
<cfset oReq = CreateObject("component", "oauth.oauthrequest").fromConsumerAndToken(
oConsumer = oConsumer,
oToken = oToken,
sHttpMethod = "GET",
sHttpURL = sAuthorizationEndpoint ,
stParameters = myParams)>
<cfset oReq.signRequest(
oSignatureMethod = oReqSigMethodSHA,
oConsumer = oConsumer,
oToken = oToken)>
<cfhttp url="#oREQ.getString()#" method="get" result="tokenResponse"/>
<cfdump var="#tokenResponse#" />
And the result of cfhttp is error 401