ColdFusion oAuth Consumer against PHP Pantheon site -
i oauth newbie , struggling implement simple oauth consumer in coldfusion against php site uses pantheon oauth library. following curl script works , returns json need.
curl -x post -i -h "content-type: application/json" -c cookies.txt -x post https://mysite.org/service/user/login?mykeyhere -d '{"username":"myuser","password":"mypassword"}'
my question how implement in coldfusion, returning responding json variable can parse?
thanks help!
ben
update 5/3/13
ok, tried translate curl line , getting closer - here's did:
<cfset mydata = serializejson('{"username":"myuser","password":"mypass"}')> <cfhttp url="https://mydomain.org/service/user/login" method="post" > <cfhttpparam type="header" name="content-type" value="application/json" > <cfhttpparam type="header" name="oauth_consumer_key" value="mykey" > <cfhttpparam type="body" value='#mydata#' > <cfhttpparam name="cookies.txt" type="cookie" value="" > </cfhttp>
however, still getting negative response - seems because not passing values in "-d" clause curl script correctly. ideas?
thanks again!
latest update: tried both of these no avail - removed cookie line:
<cfset mydata = '{"username":"myuser","password":"mypass"}'> <cfset mydata = serializejson('{"username=myuser","password=mypass"}')>
3:20 et
sorry - made correction per comment below - still no luck:
<cfset mydata = serializejson({username="user",password="pass"})>
great idea on debugging of curl post - figured out. headers - data being passed correctly.
once json created, here's cfhttp call:
<cfhttp url="https://mydomain.org/service/user/login?oauth_consumer_key=mykeyhere" method="post" > <cfhttpparam type="header" name="content-type" value="application/json" > <cfhttpparam type="header" name="accept" value="*/*" > <cfhttpparam type="body" value="#mydata#" > </cfhttp>
works great - leigh helping me think through!
Comments
Post a Comment