Search code examples
ruby-on-railsportomniauthrack-pow

Omniauth with pow port issue in Rails


I'm using Omniauth in my Rails app (which is launched locally using POW). After my providers return to the callback action, I get redirect back in port 19999. I don't want to hard code the port into the redirect_to (e.g.: redirect_to root_url, :port => PORT).

I want either to get the port dynamically or understand why the port is 19999.

If I launch my app normally (rails s -p 3000), the port doesn't change to 19999.


Solution

  • You can setup callback url's host with OmniAuth.config.full_host like:

    OmniAuth.config.full_host = "http://yourapp.dev"
    

    This must be placed before omniauth is called. I think config/initializes/omniauth.rb is good.