0
votes

I have done an application in my localhost for login with Facebook using PHP and codeigniter. I have created an app in https://developers.facebook.com/apps/ and I got the app id and secret key. 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. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

I am using wamp server and following details for Facebook app:

I also have one config file named facebook.php with following code:

$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?

2
“Also modified hosts file as follows --> 127.0.0.1 fb-login-app” – why, you are using the localhost domain as you said, and not fb-login-app - CBroe
Sorry, I saw in an article. That's why tried. It is removed now. - Jane Elizabeth Jose
in codeigniter where you use facebook login, i mean what is controller name and function name? please add controller name and function name in Site Url - Rafiqul Islam
My controller name is Signin.php and function I have written inside public function index(). I also tried site url like this before :: localhost/fb-login-app/signin but not working. - Jane Elizabeth Jose

2 Answers

0
votes

have you try in online please upload the all file in any server and you can check it. It might have problem in localhost

0
votes

The problem is solved. I have modified my Facebook.php config file as follows: `

$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/

Thanks