Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook login - how to develop on both localhost and in production?

I am developing a website which uses the Facebook login. Now, I want to be able to get this to work both in my production environment, as well as in my development environment.

On Facebook, I can give ONE site url, which Facebook can redirect to. This worked great during my development phase, but now I want it both to work in production, but also while developing my solution.

I guess one way would be to run my application on the local IIS with my domain-navn and change my hosts file, but that can't seriously be the most easy solution!?

- What is the easiest way to get it to work in both environments?

like image 575
Lars Holdgaard Avatar asked Feb 16 '13 16:02

Lars Holdgaard


People also ask

How can I login to Facebook in localhost?

You need to register as facebook developer and create you app there. Once you have your web app registered you can go to your app and click on add product. Add Facebook Login. Then enable Web OAuth Login and add your localhost in the textfield below and save, you should be able to access it.


1 Answers

Update: As of 2018 the path to this setting is now Products > Facebook Login > Settings > Client OAuth Settings the rest of this answer is still valid.


There is a better way. You just need to add valid callback URL's for your localhost to Settings > Advanced > OAuth Settings.

enter image description here

This method allows you still have your production website URL while allowing oauth from dev, staging, production, etc.

like image 91
Paul Ryan Avatar answered Sep 30 '22 02:09

Paul Ryan