]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - tests/oauth/README
Annihilate profile_tag_inbox.
[quix0rs-gnu-social.git] / tests / oauth / README
1 Some very rough test scripts for hitting up the OAuth endpoints.
2
3 These instructions assume you understand the basics of how OAuth
4 works. You may want to read up about it first. Here are some good
5 resources for learning about OAuth:
6
7     http://hueniverse.com/oauth/
8     http://tools.ietf.org/html/rfc5849
9
10 To use these scripts (and OAuth in general) first you will need to
11 register and OAuth client application with your StatusNet instance:
12
13     http://example.status.net/settings/oauthapps
14
15 oauth.ini
16 ---------
17
18 Using oauth.ini.sample as a guide, put your StatusNet OAuth endpoints
19 and consumer key and secret in a file called oauth.ini and save it
20 in the same directory as these scripts.
21
22 fetch_temp_creds.php
23 --------------------
24
25 Will fetch a request token, token secret and a URL to authorize the
26 token.  Once you authorize the request token, you can exchange it
27 for an access token.
28
29 example usage:
30
31     $ php fetch_temp_creds.php
32     Request Token
33        - oauth_token        = 89d481e376edc622f08da5791e6a4446
34        - oauth_token_secret = 6d028bcd1ea125cbed7da2f254219885
35     Authorize URL
36         http://example.status.net/api/oauth/authorize?oauth_token=89d481e376edc622f08da5791e6a4446
37
38     Now paste the Authorize URL into your browser and authorize your temporary credentials.
39
40 fetch_token_creds.php
41 ---------------------
42
43 After you have authorized your request token, you will be presented
44 with a verifier code, or pin, in your browser, which you will need
45 to get an access token. Make sure you copy it into a text buffer
46 or write it down or something. Then call fetch_token_credentials.php
47 to exchange your temporary credentials for real token credentials.
48
49 example usage:
50
51     $ php fetch_token_creds.php -t 89d481e376edc622f08da5791e6a4446 -s 6d028bcd1ea125cbed7da2f254219885 -v 305162
52     Access Token
53        - oauth_token        = 9b354df102d8e2b4621122c85d8d045c
54        - oauth_token_secret = 1800a88f1574b47d595214a74e5b1ec5
55
56
57 oauth_verify_credentials.php
58 ----------------------------
59
60 Now you should have real token credentials (an OAuth access token)
61 and you can access protected API resources. This is an example
62 script that calls /api/account/verify_credentials.xml.
63
64 example usage:
65
66     $ php oauth_verify_creds.php -t 80305cd15c5c69834364ac02d7f9178c -s 673e3b2978b1b92c8edbfe172505fee1
67     <?xml version="1.0" encoding="UTF-8"?>
68     <user xmlns:statusnet="http://status.net/schema/api/1/">
69      <id>23</id>
70      <name>zach</name>
71      <screen_name>zach</screen_name>
72      <location></location>
73      <description></description>
74      <profile_image_url>http://example.status.net/theme/default/default-avatar-stream.png</profile_image_url>
75      <url></url>
76      <protected>false</protected>
77      <followers_count>0</followers_count>
78      <profile_background_color></profile_background_color>
79      <profile_text_color></profile_text_color>
80      <profile_link_color></profile_link_color>
81      <profile_sidebar_fill_color></profile_sidebar_fill_color>
82      <profile_sidebar_border_color></profile_sidebar_border_color>
83      <friends_count>0</friends_count>
84      <created_at>Thu Sep 30 23:11:00 +0000 2010</created_at>
85      <favourites_count>0</favourites_count>
86      <utc_offset>0</utc_offset>
87      <time_zone>UTC</time_zone>
88      <profile_background_image_url></profile_background_image_url>
89      <profile_background_tile>false</profile_background_tile>
90      <statuses_count>4</statuses_count>
91      <following>true</following>
92      <statusnet:blocking>false</statusnet:blocking>
93      <notifications>true</notifications>
94      <status>
95       <text>gar</text>
96       <truncated>false</truncated>
97       <created_at>Wed Oct 06 23:40:14 +0000 2010</created_at>
98       <in_reply_to_status_id></in_reply_to_status_id>
99       <source>web</source>
100       <id>7</id>
101       <in_reply_to_user_id></in_reply_to_user_id>
102       <in_reply_to_screen_name></in_reply_to_screen_name>
103       <geo></geo>
104       <favorited>false</favorited>
105       <statusnet:html>gar</statusnet:html>
106      </status>
107      <statusnet:profile_url>http://example.status.net/statusnet/zach</statusnet:profile_url>
108     </user>
109
110 oauth_post_notice.php
111 ---------------------
112
113 This is another test script that lets you post a notice via OAuth.
114
115 example usage:
116
117     $ php oauth_post_notice.php -t 80305cd15c5c69834364ac02d7f9178c -s 673e3b2978b1b92c8edbfe172505fee1 -u 'Test test test...'
118     <?xml version="1.0" encoding="UTF-8"?>
119     <status xmlns:statusnet="http://status.net/schema/api/1/">
120      <text>Test test test...</text>
121      <truncated>false</truncated>
122      <created_at>Fri Oct 08 02:37:35 +0000 2010</created_at>
123      <in_reply_to_status_id></in_reply_to_status_id>
124      <source>&lt;a href=&quot;http://banana.com&quot; rel=&quot;nofollow&quot;&gt;Banana&lt;/a&gt;</source>
125      <id>8</id>
126      <in_reply_to_user_id></in_reply_to_user_id>
127      <in_reply_to_screen_name></in_reply_to_screen_name>
128      <geo></geo>
129      <favorited>false</favorited>
130      <user>
131       <id>23</id>
132       <name>zach</name>
133       <screen_name>zach</screen_name>
134       <location></location>
135       <description></description>
136       <profile_image_url>http://example.status.net/statusnet/theme/default/default-avatar-stream.png</profile_image_url>
137       <url></url>
138       <protected>false</protected>
139       <followers_count>0</followers_count>
140       <profile_background_color></profile_background_color>
141       <profile_text_color></profile_text_color>
142       <profile_link_color></profile_link_color>
143       <profile_sidebar_fill_color></profile_sidebar_fill_color>
144       <profile_sidebar_border_color></profile_sidebar_border_color>
145       <friends_count>0</friends_count>
146       <created_at>Thu Sep 30 23:11:00 +0000 2010</created_at>
147       <favourites_count>0</favourites_count>
148       <utc_offset>0</utc_offset>
149       <time_zone>UTC</time_zone>
150       <profile_background_image_url></profile_background_image_url>
151       <profile_background_tile>false</profile_background_tile>
152       <statuses_count>5</statuses_count>
153       <following>true</following>
154       <statusnet:blocking>false</statusnet:blocking>
155       <notifications>true</notifications>
156       <statusnet:profile_url>http://example.status.net/statusnet/zach</statusnet:profile_url>
157      </user>
158      <statusnet:html>Test test test...</statusnet:html>
159     </status>
160