-
Notifications
You must be signed in to change notification settings - Fork 12
/
EXAMPLES
108 lines (80 loc) · 3.44 KB
/
EXAMPLES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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'