intridea/omniauth — pull request #548 by emiltin (2011-11-25 18:33:28+00:00)
Title: Dynamic paths

dynamic paths for 1.0.

dynamic paths allow you to start authorization from a path like auth/twittter/my/path, which then results in a callback at auth/twitter/my/path/callback. setup and failure works the same way.

this is quite useful for scenarios where you're not just logging in a user, but authorize different items like projects or accounts. in these situations, using the same callback route is inpractical.

traditional paths should not be affected.

it works for me with both twitter and facebook, and all tests pass. test are included for the dynamic paths. but there's still a few things i wonder about, like what's going on around line 187 in lib/omniauth/strategy.rb:

if request.params['origin']
env['rack.session']['omniauth.origin'] = request.params['origin']
elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/) #when would this happen?
env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
end

feedback welcome :-)