]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apioauthaccesstoken.php
OAuth 1.0 working now
[quix0rs-gnu-social.git] / actions / apioauthaccesstoken.php
index 67359d765d6871a3c4f10c6c5d46f471716f4c71..085ef6f0b1dba92fab4b2212b8ad2da8e0377e45 100644 (file)
@@ -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,19 +43,9 @@ 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.
      *
@@ -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";
     }
 }