Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line tools for accessing APIs with Oauth support [closed]

I want to mess around with an API from the command line. I'm looking for a good command line tool with Oauth support.

Any suggestions?

like image 373
LuxuryMode Avatar asked May 04 '11 00:05

LuxuryMode


2 Answers

I'd recommend oacurl which allows you to make request from the command line. Although it is build to use Google services by supplying a properties file you can have it talk to any OAuth service.

I create a config file (eg service.properties):

consumerKey=mykey
consumerSecret=mysecret
requestTokenUrl=https://service/oauth/request_token
userAuthorizationUrl=https://service/oauth/authorize
accessTokenUrl=https://localhost/oauth/access_token

then with the JAR downloaded to the same directory, login:

java -cp oacurl-1.3.0.jar  com.google.oacurl.Login --service-provider=service.properties --consumer=service.properties

this should launch your browser and allow you to login and store your access token (along with other information) in ~/.oacurl.properties . Then you can request a URL using the access token with:

java -cp oacurl-1.3.0.jar  com.google.oacurl.Fetch https://service/protected/path

and it will use your access token to download it.

like image 170
Matthew Buckett Avatar answered Nov 14 '22 21:11

Matthew Buckett


https://github.com/decklin/curlicue

This is a nice tool for doing Oauth at command line

like image 42
Sumit Pal Avatar answered Nov 14 '22 22:11

Sumit Pal