I am using omniauth-facebook gem to do some Facebook login stuff. The call works in such a way that when /auth/facebook is called, it does the authentication process. All of that works fine when I manually enter the URL: http://localhost:3000/auth/facebook
However, when I took my code only, my domain is setup such that my apps have URLs such as:
http://railsapps.mydomain.com/app1
http://railsapps.mydomain.com/app2
http://railsapps.mydomain.com/app3
etc.
Now in my index page I have a link that is written in my .html.erb file as such:
<%= link_to "Sign in with Facebook", "/auth/facebook", id: "sign_in" %>
When I run this locally and click on the link it correctly goes to localhost:3000/auth/facebook and everything is good in the world. However, when I go online with this same code and click on this link it goes to: http://railsapps.mydomain.com/auth/facebook (which of course doesn’t work, since it should be going to railsapps.mydomain.com/app1/auth/facebook.
Any help that could be provided in this regard would be greatly appreciated.
Thank you.
You should be able to use this:
or if that doesn’t work try request.host: