Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (80 sloc) 3.44 KB
Examples
========
These examples show how to set up and then use Curlicue with various
services.
Twitter
-------
Create your own application at https://apps.twitter.com/ first.
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.1/statuses/home_timeline.json'
Historical note: when I initially wrote Curlicue, there was talk of an
"open source" key creation mechanism, where I could distribute a master
key with Curlicue's code that would somehow allow you to automatically
create your own key and secret, but that never happened[1]. You can look
in the repository's history for a tentative version of how it might have
looked.
[1] Infamously, Twitter decided they didn't want new third-party clients:
https://groups.google.com/forum/#!topic/twitter-development-talk/yCzVnHqHIWo
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'
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'