Define multiple auth routes
I'm versioning my rails app and I want to be able to authenticate an user with 2 different routes :
get 'v1/auth/:provider' => 'The omniauth method containing the appropriate callback'
get 'v1/auth/:provider/callback => 'v1/sessions#create'
get 'v2/auth/:provider' => 'The omniauth method containing the appropriate callback'
get 'v2/auth/:provider/callback => 'v2/sessions#create'
Is it possible to "hack" the prefix_path attributes so I can generate both routes ?
+1, related: I would need the support for /projects/:project_id/auth/:provider.
It would be nice to have a possibility to configure two different paths for that, but it is not supported because each OmniAuth::Builder middleware you add to the middleware stack shares one singleton OmniAuth::Configuration.instance.
@xpepermint were you able to solve that, I need exactly the same thing. @faucct do you know if it's possible now?
@balbinas, nope, OmniAuth::Configuration is still a singleton.
@balbinas at the end it was easier for me to write the whole module myself.
@xpepermint is your solution open source? cause it may help me solve my problem too! 😊
This would be a nice enhancement, we have multiple uses for omniauth throughout our app, user sign_in, connecting to 3rd party services to pull/push data.
Sometimes a single provider is used in multiple scenarios. Being a able to route and handle callbacks separately would make life much easier.
Old issue.... but... Isn't it just removing the Singleton from Configuration and change the default config returned from OmniAuth.config to something like @config ||= Configuration.new ?