r0man / oauth-clj

Clojure OAuth library
95 stars 27 forks source link

Use oauth-clj for 2-legged oauth? #5

Closed dirtyvagabond closed 12 years ago

dirtyvagabond commented 12 years ago

Hi Roman,

Is it possible to use oauth-clj for 2-legged oauth? If so, is there a demo or sample code I can take a look at?

All the best, Aaron

r0man commented 12 years ago

Hi Aaron,

I haven't used 2-legged OAuth myself yet.

Roman

metajack commented 12 years ago

It is possible. Here is an example (note this won't work until issue #6 is fixed because of the query parameters.

(def c (oauth/make-consumer :oauth-consumer-key your-consumer-key 
                                           :oauth-consumer-secret your-consumer-secret))
(c {:method :get :url "http://api.v3.factual.com/t/global :query-params {:q "Starbucks"}})

Basically you just leave the token and token secret out of the request. There is no need to get a temporary token or an access token at all in 2-legged.

r0man commented 12 years ago

Hi Aaron,

thanks for the pull request. I merged it and pushed "0.0.5-SNAPSHOT" to Clojars.

Roman.