简体   繁体   English

在本地主机中使用 codeIgniter PHP 登录 Facebook

[英]Login with Facebook using codeIgniter PHP in localhost

I have done an application in my localhost for login with Facebook using PHP and codeigniter.我已经在我的本地主机中完成了一个应用程序,用于使用 PHP 和 codeigniter 登录 Facebook。 I have created an app in https://developers.facebook.com/apps/ and I got the app id and secret key.我在https://developers.facebook.com/apps/ 中创建了一个应用程序,并获得了应用程序 ID 和密钥。 But I am getting the following warning when trying to access.但是我在尝试访问时收到以下警告。

Warning警告
Can't Load URL: The domain of this URL isn't included in the app's domains.无法加载 URL:此 URL 的域未包含在应用程序的域中。 To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.为了能够加载此 URL,请将您应用的所有域和子域添加到应用设置中的“应用域”字段。

I am using wamp server and following details for Facebook app:我正在使用 wamp 服务器和以下 Facebook 应用程序的详细信息:

I also have one config file named facebook.php with following code:我还有一个名为 facebook.php 的配置文件,其中包含以下代码:

$config['facebook_app_id']              = 'MyAPPId';
$config['facebook_app_secret']          = 'SecretKey';
$config['facebook_login_type']          = 'web';
$config['facebook_login_redirect_url']  = 'signin';
$config['facebook_logout_redirect_url'] = 'home';
$config['facebook_permissions']         = array('public_profile', 'publish_actions', 'email');
$config['facebook_graph_version']       = 'v2.9';
$config['facebook_auth_on_load']        = TRUE;

I tried so many things and nothing worked.我尝试了很多东西,但没有任何效果。 Any solution?有什么解决办法吗?

have you try in online please upload the all file in any server and you can check it.您是否在线尝试过请上传任何服务器中的所有文件,您可以检查它。 It might have problem in localhost本地主机可能有问题

The problem is solved.问题已经解决了。 I have modified my Facebook.php config file as follows: `我修改了我的 Facebook.php 配置文件如下:`

$config['app_id']                       = 'MyAPPID';
$config['app_secret']                   = 'SecretKey';
$config['facebook_login_type']          = 'web';
$config['facebook_login_redirect_url']  = 'index.php/signin';
$config['facebook_logout_redirect_url'] ='index.php/home';
$config['facebook_permissions']         = array('email','user_location','user_birthday');
$config['facebook_graph_version']       = 'v2.9';
$config['facebook_auth_on_load']        = TRUE;

` `

Reference Link : https://www.codexworld.com/facebook-login-codeigniter/参考链接: https : //www.codexworld.com/facebook-login-codeigniter/

Thanks谢谢

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

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