diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-10-20 15:57:35 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-10-20 15:57:35 +0200 |
commit | b06588ffa1c925d0a008a34bf8fa5c316b964b87 (patch) | |
tree | e17dd8db74a6da2742011d87d48a305db7d11a31 /include/api.php | |
parent | df996a8b5ed2ac33c26a522d65eca6d6a4abe439 (diff) | |
download | volse-hubzilla-b06588ffa1c925d0a008a34bf8fa5c316b964b87.tar.gz volse-hubzilla-b06588ffa1c925d0a008a34bf8fa5c316b964b87.tar.bz2 volse-hubzilla-b06588ffa1c925d0a008a34bf8fa5c316b964b87.zip |
Initial work adding oauth to api
Diffstat (limited to 'include/api.php')
-rw-r--r-- | include/api.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/include/api.php b/include/api.php index 1334d8eae..252caeb8e 100644 --- a/include/api.php +++ b/include/api.php @@ -2,7 +2,7 @@ require_once("bbcode.php"); require_once("datetime.php"); require_once("conversation.php"); - + require_once("oauth.php"); /* * Twitter-Like API * @@ -1135,3 +1135,32 @@ } api_register_func('api/direct_messages/sent','api_direct_messages_sentbox',true); api_register_func('api/direct_messages','api_direct_messages_inbox',true); + + + + function api_oauth_request_token(&$a, $type){ + try{ + $oauth = new FKOAuth1(); + $r = $oauth->fetch_request_token(OAuthRequest::from_request()); + }catch(Exception $e){ + echo "error=". OAuthUtil::urlencode_rfc3986($e->getMessage()); killme(); + } + echo "oauth_token=".$r->key."&oauth_secret=".$r->secret; + killme(); + } + function api_oauth_access_token(&$a, $type){ + try{ + $oauth = new FKOAuth1(); + $r = $oauth->fetch_access_token(OAuthRequest::from_request()); + }catch(Exception $e){ + echo "error=". OAuthUtil::urlencode_rfc3986($e->getMessage()); killme(); + } + echo "oauth_token=".$r->key."&oauth_secret=".$r->secret; + killme(); + } + function api_oauth_authorize(&$a, $type){ + } + api_register_func('api/oauth/request_token', 'api_oauth_request_token', false); + api_register_func('api/oauth/access_token', 'api_oauth_access_token', false); + api_register_func('api/oauth/authorize', 'api_oauth_authorize', false); + |