Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

store only essential user info in session

This is to prevent the session cookie from going too big

This is a cherry-pick of 766f74e
  • Loading branch information...
commit 91f3bf53905bc29f8dc868110504fceccabc7fb6 1 parent c1a2d86
@mislav authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/twitter/login.rb
View
12 lib/twitter/login.rb
@@ -101,7 +101,7 @@ def handle_twitter_authorization(request)
response = access_token.get('/1/account/verify_credentials.json')
# get and store authenticated user's info from Twitter
- request.session[:twitter_user] = Yajl::Parser.parse response.body
+ request.session[:twitter_user] = user_hash_from_response(response)
# pass the request down to the main app
response = begin
@@ -155,4 +155,14 @@ def oauth
:authorize_path => '/oauth/authenticate'
)
end
+
+ def user_hash_from_response(api_response)
+ parse_response(api_response).reject { |key, _|
+ key == 'status' or key =~ /^profile_|_color$/
+ }
+ end
+
+ def parse_response(api_response)
+ Yajl::Parser.parse api_response.body
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.