Forum: Ruby on Rails how to scope the /auth/:provider/callback , using OmniAuth for users and members

Posted by Kad Kerforn (kadoudal)
on 2012-10-06 19:07
(Received via mailing list)
I have two separate groups of people authenticated w Devise , but in
this case I cannot used the Devise embedded OmniAuth support. So i am
using directly the OmniAuth gem.

Initialized w :
Rails.configuration.middleware.use OmniAuth::Builder do
..provider :twitter,
..
end

It's running fine , but I have an issue with the callback route
mapping :

I tried
    match '/users/auth/:provider/callback', to: 'users/
omniauth_callbacks#create'
    match '/members/auth/:provider/callback', to: 'members/
omniauth_callbacks#create'
but the provider ( fb , twitter, google)  claimebd about the callback
uri :
 "/auth/:provider/callback"
..
as the path_prefix (:path_prefix => "/auth" )  is set in the
initializer , I have no mean to modify it dynamically...

any clue ? or feedback from previous experiences...

thanks
Posted by Kad Kerforn (kadoudal)
on 2012-10-07 11:04
(Received via mailing list)
[SOLVED] maybe not the best way, but it runs ..
using only one callback url, I can test the
request.env["omniauth.origin"]  which can be tested :

"http://lvh.me:3000/en/users/sign_in"
or
"http://acme.lvh.me:3000/en/members/sign_in"  ( in this cas I can even
test for current_subdomain.nil?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.