diff options
author | Zach Copley <zach@status.net> | 2010-01-13 11:31:15 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-01-14 02:41:09 +0000 |
commit | 6c8bf36fe15317dc418791947dc652f61f5645b9 (patch) | |
tree | d5dfd9e33b4fb309c8715deb45004964c9838190 /lib/apioauthstore.php | |
parent | 7c34ac8cc2c3813f05deb8ac80e511648b441914 (diff) |
Make sure applications are really looked up by consumer key
Diffstat (limited to 'lib/apioauthstore.php')
-rw-r--r-- | lib/apioauthstore.php | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/apioauthstore.php b/lib/apioauthstore.php index c39ddbb0f..32110d057 100644 --- a/lib/apioauthstore.php +++ b/lib/apioauthstore.php @@ -36,6 +36,44 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore $con->consumer_secret); } + function getAppByRequestToken($token_key) + { + // Look up the full req tokenx + + $req_token = $this->lookup_token(null, + 'request', + $token_key); + + if (empty($req_token)) { + common_debug("couldn't get request token from oauth datastore"); + return null; + } + + // Look up the full Token + + $token = new Token(); + $token->tok = $req_token->key; + $result = $token->find(true); + + if (empty($result)) { + common_debug('Couldn\'t find req token in the token table.'); + return null; + } + + // Look up the app + + $app = new Oauth_application(); + $app->consumer_key = $token->consumer_key; + $result = $app->find(true); + + if (!empty($result)) { + return $app; + } else { + common_debug("Couldn't find the app!"); + return null; + } + } + function new_access_token($token, $consumer) { common_debug('new_access_token("'.$token->key.'","'.$consumer->key.'")', __FILE__); @@ -64,7 +102,7 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore if (!empty($result)) { common_debug("Oath app user found."); } else { - common_debug("Oauth app user not found."); + common_debug("Oauth app user not found. app id $app->id token $rt->tok"); return null; } |