The situation:
Using Rails 3 and OmniAuth, I have an app that authenticates using the Facebook strategy. This app has been built to work equally-well for web and mobile interfaces (ala Jquery-Mobile).
The challenge is to get OmniAuth to provide the mobile version of Facebook’s login screen to mobile devices and the web version to desktop devices.
I’ve hacked together a solution which I’ll put as an answer.
Actually, since OmniAuth::Strategies are already Rack middleware, its even simpler. Just override the request_phase method and check the @env instance variable present in the strategy for a mobile user_agent: