Closed abhinavmsra closed 6 years ago
Hello @abhinavmsra, thanks for the detailed explanation.
Can you provide us a sample application that reproduces this issue or maybe use our bug report template? This seems like a lot of setup, so if you can provide us an executable sample that would help us find the issue faster.
Thank you!
Sorry @tegon I totally forgot about the issue. I will prepare a sample application over the weekend
I'm closing this issue because it has not had recent activity. If you're still facing this on the latest version, please open a new one with all the information requested in the template.
Thank you!
This issue still presents in the latest version.
Great explanation by @abhinavmsra . I have the same issue with Spree application (which is mounted on custom route) while using spree_social extension.
you can configure the path prefix as an option on each omniauth provider inside devise.rb
config.omniauth :google_oauth2, 'your apps id', 'your apps secret', path_prefix: '/auth'
change /auth for whatever your engine is mounted on. the only problem is that if you change the mount poit you will have to update these configs bye hand as well.
Environment
Setup
I am trying to integrate Devise inside a Rails Engine. Devise is configured to provide Omniauth authentication.
Configuration
Engine Mounted at
/auth
Devise is configured to support two omniauth providers, facebook and instagram.
rake routes
generates following routes:Its pretty standard.
Current Behavior
An interesting behavior that took quite a bit of time to debug is:
Omniauth
are scoped under root.I was expecting to access
vcliq_auth/omniauth_callbacks#passthru
via/ENGINE_MOUNT_PATH/auth/:provider
=>/auth/auth/:provider
But it turns out its still
/auth/:provider
./auth/auth/:provider
hitsDevise::OmniauthCallbacksController#passthru
generating following responseMy understanding for that is:
Omniauth
and related strategies as a Middleware and so the routes take a root scope rather than that of Engine.Expected Behavior
If the routing behavior is intentional or expected, then the routes helper should correspond that. However, route helpers still return routes namespaced under the engine mount path.
In my case,
which makes me wonder either the routes are mismatched or the path helpers are returning wrong routes.