summaryrefslogtreecommitdiff
path: root/actions/apioauthaccesstoken.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-01-13 05:06:35 +0000
committerZach Copley <zach@status.net>2010-01-24 16:36:04 -0800
commit8da5e98cba12c32f0b75a90d1ff0007b73f0fc8d (patch)
tree6ec3df66f796d42ad83c8d274d1c8667c921a949 /actions/apioauthaccesstoken.php
parentadfca0180847571b9474db76a0c4daa407acf22b (diff)
OAuth 1.0 working now
Diffstat (limited to 'actions/apioauthaccesstoken.php')
-rw-r--r--actions/apioauthaccesstoken.php40
1 files changed, 15 insertions, 25 deletions
diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php
index 67359d765..085ef6f0b 100644
--- a/actions/apioauthaccesstoken.php
+++ b/actions/apioauthaccesstoken.php
@@ -31,7 +31,7 @@ if (!defined('STATUSNET')) {
exit(1);
}
-require_once INSTALLDIR . '/lib/apioauthstore.php';
+require_once INSTALLDIR . '/lib/apioauth.php';
/**
* Exchange an authorized OAuth request token for an access token
@@ -43,20 +43,10 @@ require_once INSTALLDIR . '/lib/apioauthstore.php';
* @link http://status.net/
*/
-class ApiOauthAccessTokenAction extends Action
+class ApiOauthAccessTokenAction extends ApiOauthAction
{
/**
- * Is read only?
- *
- * @return boolean false
- */
- function isReadOnly()
- {
- return false;
- }
-
- /**
* Class handler.
*
* @param array $args array of arguments
@@ -73,7 +63,7 @@ class ApiOauthAccessTokenAction extends Action
$server->add_signature_method($hmac_method);
- $atok = null;
+ $atok = null;
try {
$req = OAuthRequest::from_request();
@@ -81,24 +71,24 @@ class ApiOauthAccessTokenAction extends Action
} catch (OAuthException $e) {
common_log(LOG_WARN, 'API OAuthException - ' . $e->getMessage());
- common_debug(var_export($req, true));
- $this->outputError($e->getMessage());
- return;
+ common_debug(var_export($req, true));
+ $this->outputError($e->getMessage());
+ return;
}
- if (empty($atok)) {
- common_debug('couldn\'t get access token.');
- print "Token exchange failed. Has the request token been authorized?\n";
- } else {
- print $atok;
- }
+ if (empty($atok)) {
+ common_debug('couldn\'t get access token.');
+ print "Token exchange failed. Has the request token been authorized?\n";
+ } else {
+ print $atok;
+ }
}
function outputError($msg)
{
- header('HTTP/1.1 401 Unauthorized');
- header('Content-Type: text/html; charset=utf-8');
- print $msg . "\n";
+ header('HTTP/1.1 401 Unauthorized');
+ header('Content-Type: text/html; charset=utf-8');
+ print $msg . "\n";
}
}