summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-10-05 17:48:32 -0700
committerZach Copley <zach@status.net>2010-10-06 13:40:03 -0700
commitf4f56eea3ae349ed7d47ae7385036107510bf5e5 (patch)
tree74d751c1264a25b9534878f421345bb365542824 /lib
parent73a73c936251f4f481eba2ca0264b49064797067 (diff)
Override new_request_token() to store OAuth 1.0a verified callback URL
Diffstat (limited to 'lib')
-rw-r--r--lib/apioauthstore.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/apioauthstore.php b/lib/apioauthstore.php
index eca93866f..620f0947f 100644
--- a/lib/apioauthstore.php
+++ b/lib/apioauthstore.php
@@ -183,4 +183,30 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
throw new Exception(_('Failed to delete revoked token.'));
}
}
+
+ /*
+ * Create a new request token. Overrided to support OAuth 1.0a callback
+ *
+ * @param OAuthConsumer $consumer the OAuth Consumer for this token
+ * @param string $callback the verified OAuth callback URL
+ *
+ * @return OAuthToken $token a new unauthorized OAuth request token
+ */
+
+ function new_request_token($consumer, $callback)
+ {
+ $t = new Token();
+ $t->consumer_key = $consumer->key;
+ $t->tok = common_good_rand(16);
+ $t->secret = common_good_rand(16);
+ $t->type = 0; // request
+ $t->state = 0; // unauthorized
+ $t->verified_callback = $callback;
+ $t->created = DB_DataObject_Cast::dateTime();
+ if (!$t->insert()) {
+ return null;
+ } else {
+ return new OAuthToken($t->tok, $t->secret);
+ }
+ }
}