[Bps-public-commit] jifty-plugin-authentication-twitter branch, master, updated. 4d8801171dc849a550a542f6809ccf30ef7cf1ab

Shawn Moore sartak at bestpractical.com
Mon Jun 7 16:31:00 EDT 2010


The branch, master has been updated
       via  4d8801171dc849a550a542f6809ccf30ef7cf1ab (commit)
      from  69b4f23b50d57c91cb88e617d4ba9ba53b73ace5 (commit)

Summary of changes:
 .../Plugin/Authentication/Twitter/Dispatcher.pm    |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 4d8801171dc849a550a542f6809ccf30ef7cf1ab
Author: Shawn M Moore <sartak at gmail.com>
Date:   Mon Jun 7 16:31:42 2010 -0400

    Keep track of the request token secret between requests

diff --git a/lib/Jifty/Plugin/Authentication/Twitter/Dispatcher.pm b/lib/Jifty/Plugin/Authentication/Twitter/Dispatcher.pm
index 604b335..6eb4361 100644
--- a/lib/Jifty/Plugin/Authentication/Twitter/Dispatcher.pm
+++ b/lib/Jifty/Plugin/Authentication/Twitter/Dispatcher.pm
@@ -26,15 +26,9 @@ Handles the login callback. You probably don't need to worry about this.
 
 =cut
 
-before '/twitter/callback' => run {
-    # add action
-
-    if ( Jifty->web->request->continuation ) {
-        Jifty->web->request->continuation->call;
-    }
-    else {
-        redirect '/';
-    }
+on '/twitter/callback' => run {
+    my $token = Jifty->web->request->argument('oauth_token');
+    my $secret = Jifty::CAS->key('twitter_oauth' => $token);
 };
 
 on '/twitter/login' => run {
@@ -59,6 +53,9 @@ on '/twitter/login' => run {
 
     my $response = Net::OAuth::RequestTokenResponse->from_post_body($res->content);
 
+    # keep track of the token secret between requests
+    Jifty::CAS->publish('twitter_oauth' => $response->token, $response->token_secret);
+
     my $auth_request = Net::OAuth::UserAuthRequest->new(
         consumer_key     => $plugin->consumer_key,
         consumer_secret  => $plugin->consumer_secret,

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list