I am working on a project that needs to allow for organizations to configure their own google oauth integration for SSO. Looking through documentation and code, it didn't seem that this is yet supported out of the box. I was able to achieve it with a simple module and including it into OmniAuth::Strategies::GoogeOauth2 in my devise.rb initializer prior to loading it:
# config/initializers/devise.rb
module GoogleOmniAuthProviderCustomization
def self.included(klass)
klass.option :tenant_provider, nil
end
def client
provider = if options.tenant_provider.class.is_a?(Class)
options.tenant_provider.new(self)
else
options
end
options.client_id = provider.client_id
options.client_secret = provider.client_secret
super
end
end
OmniAuth::Strategies::GoogleOauth2.include(GoogleOmniAuthProviderCustomization)
Devise.setup do |config|
...
config.omniauth :google_oatuh2, tenant_provider: MyCustomGoogleProvider
...
end
If this is something that you feel would be of value I'm happy to submit a PR to extend the current functionality. Thanks for your time.
Hello,
I am working on a project that needs to allow for organizations to configure their own google oauth integration for SSO. Looking through documentation and code, it didn't seem that this is yet supported out of the box. I was able to achieve it with a simple module and including it into
OmniAuth::Strategies::GoogeOauth2
in mydevise.rb
initializer prior to loading it:If this is something that you feel would be of value I'm happy to submit a PR to extend the current functionality. Thanks for your time.