Dominic Goulet
Dominic Goulet

Reputation: 8113

Omniauth route issue related to ruby version?

I have create a rails engine that uses omniauth. In that engine, regardless of running on ruby 1.8.7 or 1.9.2, when I test it using the dummy application, everything works just as fine (using Rails 3.1.3).

I can login using any of the providers by going to /auth/:provider, such as /auth/google.

When I include (as a gem) that engine and mount it to '/' in the host application, the login process works when I use ruby 1.8.7, but gives me a No route matches [GET] "/auth/google when I use ruby 1.9.2.

So, to wrap it up, I get a No route matches [GET] "/auth/google when Omniauth is inside an engine and that I use Ruby 1.9.2.

I tried the devise solution where you create a pass thru action that generates a 404 error, but if I do that, I then get stuck on that 404 error...

Any ideas?

Upvotes: 0

Views: 382

Answers (1)

Dmitry Lihachev
Dmitry Lihachev

Reputation: 504

write the following code in your Engine

middleware.use OmniAuth::Builder do
  provider :provider, 'APP_ID', 'APP_SECRET' 
end

and you will have login url under /mount_point/auth/:provider

Upvotes: 1

Related Questions