Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

121 lines (88 sloc) 3.785 kB
Examples
========
These examples show how to set up and then use Curlicue with various
services.
Twitter
-------
This is for authenticating as your own app (generating a personalized
Curlicue consumer key with the "open source" key exchange mechanism has
been delayed indefinitely, so I have removed the separate setup script
for it).
curlicue-setup \
'https://api.twitter.com/oauth/request_token' \
'https://api.twitter.com/oauth/authorize?oauth_token=$oauth_token' \
'https://api.twitter.com/oauth/access_token' \
credentials
curlicue -f credentials \
'https://api.twitter.com/1/statuses/home_timeline.xml'
Google
------
Google requires an initial "scope" parameter. For this example, we'll
ask for access to Calendar. Note that the consumer key and consumer
secret are both "anonymous".
Also note that Google is strict about scope: If you specify HTTPS, you
must use HTTPS for all authenticated requests.
curlicue-setup \
'https://www.google.com/accounts/OAuthGetRequestToken?scope=https%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F' \
'https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=$oauth_token' \
'https://www.google.com/accounts/OAuthGetAccessToken' \
credentials
curlicue -f credentials \
'https://www.google.com/calendar/feeds/default/allcalendars/full'
Yahoo
-----
When setting up your application on Yahoo Developer Network, you need to
choose at least one service that requires read/write access. For my test
application I chose Delicious.
curlicue-setup \
'https://api.login.yahoo.com/oauth/v2/get_request_token' \
'https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=$oauth_token' \
'https://api.login.yahoo.com/oauth/v2/get_token' \
credentials
curlicue -f credentials \
'http://api.del.icio.us/v2/posts/recent'
Netflix
-------
Note that there is no PIN returned (just hit Enter); they appear to be
using OAuth 1.0, since exchanging the request token for an access token
works anyway.
Unlike the others, the token exchange is done over insecure HTTP.
curlicue-setup \
'http://api.netflix.com/oauth/request_token' \
'https://api-user.netflix.com/oauth/login?application_name=$application_name&oauth_consumer_key=$oauth_consumer_key&oauth_token=$oauth_token' \
'http://api.netflix.com/oauth/access_token' \
credentials
curlicue -f credentials \
'http://api.netflix.com/catalog/titles'
TripIt
------
In this case, the "oob" callback is not supported, but we also don't need
a PIN, so we can fake it with an invalid URL.
curlicue-setup \
'https://api.tripit.com/oauth/request_token' \
'https://www.tripit.com/oauth/authorize?oauth_token=$oauth_token&oauth_callback=http%3A%2F%2Fnowhere.invalid%2F' \
'https://api.tripit.com/oauth/access_token' \
credentials
curlicue -f credentials \
'https://api.tripit.com/v1/list/trip'
Vimeo
-----
This one is pretty straightforward.
curlicue-setup \
'http://vimeo.com/oauth/request_token' \
'http://vimeo.com/oauth/authorize?oauth_token=$oauth_token&permission=read' \
'http://vimeo.com/oauth/access_token' \
credentials
curlicue -f credentials \
'http://vimeo.com/api/rest/v2/?method=vimeo.channels.getAll'
Test Server
-----------
A kind soul is running this test server. No authorization needed, so
again, leave the PIN blank.
curlicue-setup \
'http://term.ie/oauth/example/request_token.php' \
'' \
'http://term.ie/oauth/example/access_token.php' \
credentials
curlicue -f credentials \
'http://term.ie/oauth/example/echo_api.php?foo=bar'
Jump to Line
Something went wrong with that request. Please try again.