Similar questions were asked, but solutions to these problems do not seem to help me.
I have a local development site configured on a virtual machine: http://lamp.site
When index.php loads, this javascript works for me (with the correct appId):
/* facebook auth */ window.fbAsyncInit = function() { FB.init({ appId: '01234567890', channelUrl: 'http://lamp.site/channel.html' }); }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document));
Then, when the button is pressed, this javascript function is activated:
#HTML <li><a class="btn" href="#" ng-click="connectToFacebook()">Connect with Facebook</a></li> #Snippet in AngularJS Controller $scope.connectToFacebook = function() { facebookConnect.authenticate( function(reason) { // fail console.log(reason); }, function(user) { // success console.log('logged in',user); //Session.login(); }); return false; } #Factory in AngularJS module .factory('facebookConnect', function() { return { authenticate: function(fail, success) { FB.login(function(response) { console.log(response); if (response.authResponse) { FB.api('/me', success); } else { fail('User cancelled login or did not fully authorize.'); } }); } }
If I click a button in Firefox, it will work! Great, I get all the right things from Facebook.
If I use Chrome or Safari on my PC or Safari Mobile on my iPhone, I get a facebook login pop-up with the message "An error has occurred. Please try again later" and the following console data:
Unsafe JavaScript attempt to access frame with URL https://www.facebook.com/dialog/permissions.request from frame with URL http://lamp.site/index.php?page=login. Domains, protocols and ports must match. Object authResponse: null status: "not_authorized" __proto__: Object User cancelled login or did not fully authorize.
I have my local testing URL added to the facebook application in the developer section, which works because it logs in with Firefox. This is my feeds file saved in http://lamp.site/channel.html
<script src="http://connect.facebook.net/en_US/all.js"></script>
I tried to have a channel file with and without http: in the src = tag.
The facebook application has the following settings:
So it works in Firefox, what the hell am I doing wrong. I can’t just turn on cross-site scripting, as users wouldn’t, and this is happening on the mobile site.
Has anyone else managed to solve this problem recently?
All other similar questions remained unanswered ... someone had to fix it!
EDIT: I made a simplified version, a new application identifier, on my website.
http://dev.willshawmedia.com/fb/
Here is a screenshot with the app ID from the Facebook Dev app bar

You can see the source code, it was copied right here:
https://developers.facebook.com/docs/guides/web/
And the channel file exists:
http://dev.willshawmedia.com/fb/channel.html
I can’t make it easier, I still get the message "An error has occurred. Please try again later." message, but now it just goes to Facebook instead of authentication and closure.
Edit: I didn’t have enough site URLs, I added them, a simple example works.
How it works on my site, this should be related to my local domains. But I have this line in / etc / hosts / file:
192.168.0.13 lamp.site
That the IP address of the VirtualBox Ubuntu server is working on my laptop. I can browse this site well.