Skip to content

Commit

Permalink
restart the auth flow when the facebook session expired
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Belo committed Sep 14, 2011
1 parent a23ff5e commit 90c768e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require "mogli"

enable :sessions
set :raise_errors, false
set :show_exceptions, false

FACEBOOK_SCOPE = 'email, status_update, publish_stream, publish_actions, user_likes, user_photos'

Expand Down Expand Up @@ -32,6 +34,12 @@ def first_column(item, collection)
end
end

# the facebook session expired! reset ours and restart the process
error(Mogli::Client::HTTPException) do
session[:at] = nil
redirect "/auth/facebook"
end

get "/" do
redirect "/auth/facebook" unless session[:at]
@client = Mogli::Client.new(session[:at])
Expand Down

0 comments on commit 90c768e

Please sign in to comment.