Facebook javascript connect with localhost domain

半腔热情 提交于 2019-11-30 23:45:20
orszaczky

I know that this is an old question but here is a tested and working solution for anyone who ends up here looking for an answer:

At start App Domains field should be left blank.

Click 'Add Platform' button below and choose 'Website'.

In the new Website form you can add localhost in the Site URL field:

eg. http://localhost:3000/

For a visual guide with images you can check this answer.

Apart from this, you can actually use user123's answer, and map localhost to a local domain (eg. 'myproject.dev') and the local dev domain must be entered in the same Site URL field: eg. http://myproject.dev/

user123

You should use some alias domain when you want to connect your Facebook application with your local environment.

Try the following:

       Go to your etc/hosts file and add the following line:

       127.0.0.1 dev01.dev # you can change domain to whatever you want

       Go to Facebook App Dashboard and register your application using dev01.dev as domain!

       Add your Site URL (eg. http://dev01.dev/project/ )

It should works.

Edit: You can also check this question: Facebook development in localhost

Source: facebook localhost developer

AshMan

In facebook, please refer following steps if facebook javascript SDK doesn't work in chrome.

  1. Keep App Domain blank
  2. Site URL : localhost/App_Name

Disable all plugins from chrome. Especially Ad blocker which will give you a :

307 Internal Status Code

It should work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!