diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-11-07 17:36:58 +0100 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-11-07 17:36:58 +0100 |
commit | 41cbd84a74eff278787daf3c23582c49cf814236 (patch) | |
tree | 97a648309f9fb595442352476d387a143eb247a0 | |
parent | 10e5754e247e9adf7c576547c69d12ca09973c7a (diff) | |
download | volse-hubzilla-41cbd84a74eff278787daf3c23582c49cf814236.tar.gz volse-hubzilla-41cbd84a74eff278787daf3c23582c49cf814236.tar.bz2 volse-hubzilla-41cbd84a74eff278787daf3c23582c49cf814236.zip |
api: login with oauth
-rw-r--r-- | include/api.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/api.php b/include/api.php index 2de965681..d8942bfff 100644 --- a/include/api.php +++ b/include/api.php @@ -27,6 +27,23 @@ * Simple HTTP Login */ function api_login(&$a){ + // login with oauth + try{ + $oauth = new FKOAuth1(); + list($consumer,$token) = $oauth->verify_request(OAuthRequest::from_request()); + if (!is_null($token)){ + $oauth->loginUser($token->uid); + call_hooks('logged_in', $a->user); + return; + } + echo __file__.__line__.__function__."<pre>"; var_dump($consumer, $token); die(); + }catch(Exception $e){ + logger(__file__.__line__.__function__."\n".$e); + //die(__file__.__line__.__function__."<pre>".$e); die(); + } + + + // workaround for HTTP-auth in CGI mode if(x($_SERVER,'REDIRECT_REMOTE_USER')) { $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"],6)) ; @@ -1145,7 +1162,7 @@ }catch(Exception $e){ echo "error=". OAuthUtil::urlencode_rfc3986($e->getMessage()); killme(); } - echo "oauth_token=".$r->key."&oauth_secret=".$r->secret; + echo $r; killme(); } function api_oauth_access_token(&$a, $type){ @@ -1155,7 +1172,7 @@ }catch(Exception $e){ echo "error=". OAuthUtil::urlencode_rfc3986($e->getMessage()); killme(); } - echo "oauth_token=".$r->key."&oauth_secret=".$r->secret; + echo $r; killme(); } |