mixed up token keys and OAuthToken objects

darcs-hash:20080606060601-84dde-a1ae6f677c2846f9d10af18cd7f001ae5e560403.gz
This commit is contained in:
Evan Prodromou 2008-06-06 02:06:01 -04:00
parent aefa900dd7
commit 7bbb4ef7c7

View File

@ -39,10 +39,10 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
return new OAuthConsumer($con->consumer_key, ''); return new OAuthConsumer($con->consumer_key, '');
} }
function lookup_token($consumer, $token_type, $token) { function lookup_token($consumer, $token_type, $token_key) {
$t = new Token(); $t = new Token();
$t->consumer_key = $consumer->key; $t->consumer_key = $consumer->key;
$t->tok = $token; $t->tok = $token_key;
$t->type = ($token_type == 'access') ? 1 : 0; $t->type = ($token_type == 'access') ? 1 : 0;
if ($t->find(true)) { if ($t->find(true)) {
return new OAuthToken($t->tok, $t->secret); return new OAuthToken($t->tok, $t->secret);
@ -54,7 +54,7 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
function lookup_nonce($consumer, $token, $nonce, $timestamp) { function lookup_nonce($consumer, $token, $nonce, $timestamp) {
$n = new Nonce(); $n = new Nonce();
$n->consumer_key = $consumer->key; $n->consumer_key = $consumer->key;
$n->tok = $token; $n->tok = $token->key;
$n->nonce = $nonce; $n->nonce = $nonce;
if ($n->find(TRUE)) { if ($n->find(TRUE)) {
return TRUE; return TRUE;
@ -67,7 +67,6 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
} }
function new_request_token($consumer) { function new_request_token($consumer) {
common_debug('new_request_token("'.$consumer->key.'")', __FILE__);
$t = new Token(); $t = new Token();
$t->consumer_key = $consumer->key; $t->consumer_key = $consumer->key;
$t->tok = common_good_rand(16); $t->tok = common_good_rand(16);
@ -91,8 +90,9 @@ class LaconicaOAuthDataStore extends OAuthDataStore {
function new_access_token($token, $consumer) { function new_access_token($token, $consumer) {
$rt = new Token(); $rt = new Token();
$rt->consumer_key = $consumer->key; $rt->consumer_key = $consumer->key;
$rt->tok = $token; $rt->tok = $token->key;
if ($rt->find(TRUE) && $rt->state == 1) { $rt->type = 0; # request
if ($rt->find(TRUE) && $rt->state == 1) { # authorized
$at = new Token(); $at = new Token();
$at->consumer_key = $consumer->key; $at->consumer_key = $consumer->key;
$at->tok = common_good_rand(16); $at->tok = common_good_rand(16);