omniauth icon indicating copy to clipboard operation
omniauth copied to clipboard

Define multiple auth routes

Open jeromeboe opened this issue 11 years ago • 8 comments

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 ?

jeromeboe avatar Sep 25 '14 13:09 jeromeboe

+1, related: I would need the support for /projects/:project_id/auth/:provider.

xpepermint avatar Jan 25 '15 22:01 xpepermint

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.

faucct avatar Aug 08 '15 09:08 faucct

@xpepermint were you able to solve that, I need exactly the same thing. @faucct do you know if it's possible now?

balbinas avatar May 28 '16 01:05 balbinas

@balbinas, nope, OmniAuth::Configuration is still a singleton.

faucct avatar May 28 '16 06:05 faucct

@balbinas at the end it was easier for me to write the whole module myself.

xpepermint avatar May 28 '16 16:05 xpepermint

@xpepermint is your solution open source? cause it may help me solve my problem too! 😊

balbinas avatar May 28 '16 23:05 balbinas

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.

SirRawlins avatar Apr 09 '18 08:04 SirRawlins

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 ?

henrikbjorn avatar Apr 12 '24 07:04 henrikbjorn