OAuth Error - Unable to know exact cause for this error

Looking again, the oauth2_debug_auth setting likely takes effect when the server is started, since the oauth middleware and the logger for debugging gets attached at that time.

def register_middleware(omniauth)
  omniauth.provider :oauth2_basic,
  ...
      opts[:client_options][:connection_build] = lambda do |builder|
        if SiteSetting.oauth2_debug_auth && defined?(OAuth2FaradayFormatter)
          builder.response :logger,
                         Rails.logger,
                         { bodies: true, formatter: OAuth2FaradayFormatter }
        end
  ...
    }
end

Most site settings do not require a restart, but you will need to restart your server for this particular setting to take effect.


That said, the real underlying issue is Faraday::TimeoutError (Timeout::Error), though. I don’t think my suggestion to turn off logs will fix your problem. You will likely have to check if there are any network issues between your Discourse instance and OAuth2 provider.