简体   繁体   English

Wordpress主题,使用Facebook登录无法在本地主机上运行

[英]Wordpress themes, login using Facebook not working on localhost

I am using wordpress themes on localhost on a mac device. 我在Mac设备上的localhost上使用wordpress主题。 I tried on two different themes the Facebook login feature that they integrate in their settings and on both I get the same error: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings. 我尝试将Facebook登录功能集成到设置中的两个不同主题,但都遇到了相同的错误: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings. Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

Just to mention that earlier I have written a simple AngularJS project and tested the Facebook Login on localhost and it worked fine. 刚才提到,我已经编写了一个简单的AngularJS项目,并在localhost上测试了Facebook Login,并且工作正常。 I mentioned local.foo.com as the website on facebook developer when creating new App and I edited the /etc/hosts file on mac and added the entry: 127.0.0.1 local.foo.com to make it work. 创建新应用程序时,我在Facebook开发人员网站上提到了local.foo.com ,并在Mac上编辑了/ etc / hosts文件,并添加了条目: 127.0.0.1 local.foo.com以使其正常运行。

Now, when trying it on the wordpress themes, I created a new App on facebook developer, and I mentioned local.foo.com as the website (same as I did when I created the working AngularJs example). 现在,当尝试使用wordpress主题时,我在facebook开发人员上创建了一个新的应用程序,并提到local.foo.com作为网站(与创建有效的AngularJs示例时的操作相同)。 I used the new App Id in the theme settings, and when trying to login I got the error mentioned above on 2 different themes. 我在主题设置中使用了新的应用ID,尝试登录时遇到了上面提到的2个不同主题的错误。 I used the same settings that I used for the working AngularJS App. 我使用了与正常工作的AngularJS应用相同的设置。 The following image shows the settings on facebook. 下图显示了Facebook上的设置。

Facebook设置

Note that I tried to enable more options and to fill the Valid OAuth Redirect URIs field with entries like http://localhost/lovestory corresponding to what appears when I open the app in browser (for example http://127.0.0.1:8888/lovestory ), but facebook does not accept anymore URIs with http, since they require only https. 请注意,我尝试启用更多选项,并用诸如http:// localhost / lovestory之类的条目填充“ Valid OAuth Redirect URIs字段,这些条目与在浏览器中打开应用程序时对应的条目(例如http://127.0.0.1:8888) / lovestory ),但facebook不再接受带有http的URI,因为它们仅需要https。

Lately facebook requires https. 最近,Facebook需要使用https。 Therefore, an SSL certificate has to created locally and used. 因此,必须在本地创建并使用SSL证书。 Here is a process to create it: https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec 这是创建它的过程: https : //medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM