Facebooker Gem Session Key Expired
My Facebook Connect Rails application worked earlier today, but seems to have stopped getting the Facebook sessions properly.
I'm using the Facebooker gem to handle the interaction with Facebook. All of a sudden, my application started throwing this exception, both while I was logged in to my Facebook account and while I was logged out (on the actual Facebook site):
WelcomeController#index (ActionView::TemplateError) "Session key invalid or no longer valid"
On line #4 of app/views/welcome/_friends.html.erb
1: <div class="bluebox friends_box">
2: <h3>Friends</h3>
3: <table class="friends_table">
4: <% friends = facebook_user.friends_with_this_app %>
5: <% if friends.any? %>
6: <% friends.each do |friend| %>
7: <tr class="friend_row">
app/views/welcome/_friends.html.erb:4
开发者_JAVA百科app/views/welcome/_logged_in_index.html.erb:90
app/views/welcome/index.html.erb:2
<internal:prelude>:8:in `synchronize'
<internal:prelude>:8:in `synchronize'
First of all, make sure that your app is authorized with Facebook by going to the following address in the browser window where you got the exception:
http://www.facebook.com/login.php?api_key=YOUR_APP_KEY&next=RETURN_URL
If you're getting the error after that, more than likely, it has to do with Facebook itself. Sometimes it helps to get the session key out of cookie ("YOUR_APP_KEY" + "_session_key"
cookie), but sometimes it doesn't work either.
精彩评论