omniauth_openid_connect icon indicating copy to clipboard operation
omniauth_openid_connect copied to clipboard

multiple open_id providers with devise

Open masciugo opened this issue 2 years ago • 2 comments

The doc says:

NOTE: if you use this gem with Devise you should use :openid_connect name, or Devise would route to 'users/auth/:provider' rather than 'users/auth/openid_connect'

this means that I cannot use more openid providers when using Devise?

thank you

masciugo avatar May 30 '22 09:05 masciugo

There should be hints here: https://github.com/betagouv/civilsdeladefense/pull/782

Not sure how they make it work since they use devise and also use custom name provider

ssoulless avatar Jun 29 '22 17:06 ssoulless

You can have however many providers you'd like (we have 3). In config/initializers/devise.rb :

config.omniauth(
    :openid_connect,
    name: :your_provider_name,
    issuer: YOUR_PROVIDER_ISSUER_URL,
    discovery: true,
    # other options you may need
    client_options: {
      identifier: YOUR_CLIENT_ID,
      secret: YOUR_CLIENT_SECRET,
    },
  )

This will use the name option to route to /users/auth/:provider like /users/auth/your_provider_name

JeanSebTr avatar Feb 10 '23 18:02 JeanSebTr