I’m using ruby, sinatra, and the koala gem to create an app for facebook.
When I redirect to /auth/facebook It does what is needed, however it first redirects to a page with this rectangle, then goes to the auth dialog. I think this is very ugly for the end user. How can I remove this strange redirection?

Code:
#This function defines a get and post route with the same parameters.
def get_or_post(path, opts={}, &block)
get(path, opts, &block)
post(path, opts, &block)
end
get "/auth/facebook/?" do
redirect authenticator.url_for_oauth_code(:permissions => FACEBOOK_SCOPE)
end
get_or_post '/auth/facebook/callback/?' do
session[:access_token] = authenticator.get_access_token(params[:code])
update_user()
redirect '/'
end
I guess you are doing the redirect inside of the canvas iframe? That of course would try to display the auth dialog inside of that iframe, and the auth dialog does not want to be displayed in any kind of (i)frame.
So instead of redirecting (where you can not specify a target), use JavaScript to “redirect” – have your script put out a small HTML document, that basically just contains one line of JavaScript, that uses
to load a new URL in the top frame of the current browser window.