简体   繁体   中英

facebook website login with app not doing login

I am just newbie to facebook app and I am doing a simple login in a page from facebook SDK with application id.

I have created the app in facebook. After that my facebook code something looks like this

window.fbAsyncInit = function() {
   FB.init({
     appId      : '619422074760339', // App ID
     channelURL : '', // Channel File, not required so leave empty
     status     : true, // check login status
     cookie     : true, // enable cookies to allow the server to access the session
     oauth      : true, // enable OAuth 2.0
     xfbml      : false  // parse XFBML
   });
};

I have given the appId and secret key. When I tried to login from my localhost using this script it showed me error like

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings.  It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

So can someone kindly tell me how to solve this issue. Any help and suggestions will be really appreciable. Thanks

The server your app is running on doesn't have the same URL as you have given in the Facebook Apps Setting.

Please check both the URL's , they have to be same.

I had a same problem and I found that there was a mismatch in my "redirect_uri" and "Valid OAuth redirect URIs".

In my code, I had set:

redirect_uri = "http://www.mywebsite.com/validate.php";

But in my Facebook app I had set Valid OAuth redirect URIs (in Settings):

http://website.com/validate.php

All I was missing "www". So I changed Valid OAuth redirect URI in my Facebook app to following:

http://www.website.com/validate.php

I worked like a magic for me. Hope it will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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