Search code examples
ruby-on-railsomniauth

Make request using https not http using Rails intridea/omniauth


How do you configure the Rails intridea/omniauth gem to make a HTTPS request when authenticating (using localhost)?

Is it in the specific strategy (fb, linkedin, pinterest, etc) or do I do it in the middleware config or someplace else(config/application.rb)?


Solution

  • You should be able to configure this in the OmniAuth::Builder configuration, through the client_options parameter.

    You can configure custom endpoints via client_options hash passed to provider.

    From the documentation for omniauth-facebook.

    Example:

    # config/initializers/omniauth.rb
    
    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :facebook, ENV["APP_ID"], ENV["APP_SECRET"],
        client_options: {
          site: "https://graph.facebook.com/v2.0",
          authorize_url: "https://www.facebook.com/v2.0/dialog/oauth"
        }
    end