App Domains: localhost
Website with Facebook login: http://localhost/auth
idę http://localhost/auth/
iw mojej konsoli programisty Chrome widzę błąd: 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.
Co robię źle w tworzeniu aplikacji Facebook na localhost?
robię view-source, aby zobaczyć, co następuje:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div id="fb-root"></div>
<script>
// Additional JS functions here
window.fbAsyncInit = function() {
FB.init({
appId : 'myappidremovedfromstackoverflowquestion', // App ID
channelUrl : '//localhost/auth/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional init code here
};
// 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));
</script>
<p>hello</p>
</body>
</html>
idę http://localhost/auth/channel.html
i wyświetl źródło, aby wyświetlić pojedynczą linię:
<script src="//connect.facebook.net/en_US/all.js"></script>
Ponieważ zegary SO nie pozwolą mi edytować odpowiedzi, opublikuję odpowiednią część jako komentarz: Problem polegał na tym, że w pewnym momencie ustawiłem prawidłowy identyfikator URI przekierowania OAuth w ustawieniach zaawansowanych na coś różne i to było przesłonięcie wszystkich innych ustawień. Opróżnienie tego pola naprawiło problem, ale oczywiście właściwą poprawką byłoby ustawienie tego pola na konkretny adres URL, pod który chcę otrzymać token dostępu. – necromancer
Fantastyczna odpowiedź! – user123
Oprócz tego, jeśli używasz niestandardowego portu, np. 127: 0.0.1: 8080, dla mnie działało to tylko wtedy, gdy dodałem port w desce rozdzielczej Facebooka. Tak więc w/etc/hosts 127.0.0.1, ale w FB: 127.0.0.1:8080 – willdanceforfun