summaryrefslogtreecommitdiff
path: root/lib/apioauthstore.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-01-13 11:31:15 +0000
committerZach Copley <zach@status.net>2010-01-24 16:36:05 -0800
commitc0eee277d1058c9c291b3c4474cc8a72cb8c6d0e (patch)
treecbed89b9d1b76cfb4f7c74bd6ac4baf6f4a6fa6d /lib/apioauthstore.php
parente101a6df6ba1cbec4664bb81fc81655e5db18b0f (diff)
Make sure applications are really looked up by consumer key
Diffstat (limited to 'lib/apioauthstore.php')
-rw-r--r--lib/apioauthstore.php40
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;
}