Diogo Cordeiro 81d50c4ec3 [FORMAT] Run php-cs-fixer on tests/ 4 tahun lalu
..
README baa8ae778a Update OAuth test script README 14 tahun lalu
fetch_temp_creds.php 81d50c4ec3 [FORMAT] Run php-cs-fixer on tests/ 3 tahun lalu
fetch_token_creds.php 81d50c4ec3 [FORMAT] Run php-cs-fixer on tests/ 3 tahun lalu
oauth.ini.sample 2291d68e70 Default to ssl in oauth tests examples config 14 tahun lalu
oauth_post_notice.php 81d50c4ec3 [FORMAT] Run php-cs-fixer on tests/ 3 tahun lalu
oauth_verify_creds.php 81d50c4ec3 [FORMAT] Run php-cs-fixer on tests/ 3 tahun lalu

README

Some very rough test scripts for hitting up the OAuth endpoints.

These instructions assume you understand the basics of how OAuth
works. You may want to read up about it first. Here are some good
resources for learning about OAuth:

http://hueniverse.com/oauth/
http://tools.ietf.org/html/rfc5849

To use these scripts (and OAuth in general) first you will need to
register and OAuth client application with your StatusNet instance:

http://example.status.net/settings/oauthapps

oauth.ini
---------

Using oauth.ini.sample as a guide, put your StatusNet OAuth endpoints
and consumer key and secret in a file called oauth.ini and save it
in the same directory as these scripts.

fetch_temp_creds.php
--------------------

Will fetch a request token, token secret and a URL to authorize the
token. Once you authorize the request token, you can exchange it
for an access token.

example usage:

$ php fetch_temp_creds.php
Request Token
- oauth_token = 89d481e376edc622f08da5791e6a4446
- oauth_token_secret = 6d028bcd1ea125cbed7da2f254219885
Authorize URL
http://example.status.net/api/oauth/authorize?oauth_token=89d481e376edc622f08da5791e6a4446

Now paste the Authorize URL into your browser and authorize your temporary credentials.

fetch_token_creds.php
---------------------

After you have authorized your request token, you will be presented
with a verifier code, or pin, in your browser, which you will need
to get an access token. Make sure you copy it into a text buffer
or write it down or something. Then call fetch_token_credentials.php
to exchange your temporary credentials for real token credentials.

example usage:

$ php fetch_token_creds.php -t 89d481e376edc622f08da5791e6a4446 -s 6d028bcd1ea125cbed7da2f254219885 -v 305162
Access Token
- oauth_token = 9b354df102d8e2b4621122c85d8d045c
- oauth_token_secret = 1800a88f1574b47d595214a74e5b1ec5


oauth_verify_credentials.php
----------------------------

Now you should have real token credentials (an OAuth access token)
and you can access protected API resources. This is an example
script that calls /api/account/verify_credentials.xml.

example usage:

$ php oauth_verify_creds.php -t 80305cd15c5c69834364ac02d7f9178c -s 673e3b2978b1b92c8edbfe172505fee1


23
zach
zach


http://example.status.net/theme/default/default-avatar-stream.png

false
0





0
Thu Sep 30 23:11:00 +0000 2010
0
0
UTC

false
4
true
false
true

gar
false
Wed Oct 06 23:40:14 +0000 2010

web
7



false
gar

http://example.status.net/statusnet/zach


oauth_post_notice.php
---------------------

This is another test script that lets you post a notice via OAuth.

example usage:

$ php oauth_post_notice.php -t 80305cd15c5c69834364ac02d7f9178c -s 673e3b2978b1b92c8edbfe172505fee1 -u 'Test test test...'


Test test test...
false
Fri Oct 08 02:37:35 +0000 2010

<a href="http://banana.com" rel="nofollow">Banana</a>
8



false

23
zach
zach


http://example.status.net/statusnet/theme/default/default-avatar-stream.png

false
0





0
Thu Sep 30 23:11:00 +0000 2010
0
0
UTC

false
5
true
false
true
http://example.status.net/statusnet/zach

Test test test...