realdoug/omniauth-salesforce

Can't specify custom redirect_uri

Yaroslav-F opened this issue · 1 comments

Hi there, thanks for the gem.

I've been struggling to specify custom callback_url for salesforce. Locally my application is running on http://test.lvh.me:3000/ (Please note custom subdomain test)

My code is:

# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :salesforce, 'consumer_key','consumer_secret', callback_path: 'http://localhost:3000/auth/salesforce/callback'
end

app/views/salesforces/show.haml

= link_to 'click here', "/auth/salesforce"

generated link contains redirect_uri parameter that looks like:
redirect_uri=http%3A%2F%2Ftest.lvh.me%3A3000http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fsalesforce%2Fcallback
Basically it squeezes together my host test.lvh.me:3000/auth/salesforce/callback and localhost:3000/auth/salesforce/callback and puts it all into redirect_uri.

How can I get rid of test.lvh.me:3000/auth/salesforce/callback in the redirect_uri parameter?

Thanks

Fixed by adding OmniAuth.config.full_host = "http://localhost:3000" to development.rb