intridea/omniauth — Issue #546: dynamic paths for 1.0
Author: emiltin
Created: 2011-11-23 18:41:21+00:00
State: open

i updated my earlier dynamic path fork to work with the latest 1.0 from the main repo.

https://github.com/emiltin/omniauth

dynamic paths allow you to start authorization from a path like auth/twittter/my/path, which would result in a callback at auth/twitter/my/path/callback.

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.

it works for me with both twitter and facebook, and all tests pass. 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 :-)