Was mache ich falsch localhost Facebook app-Entwicklung?
App Domains: localhost
Website with Facebook login: http://localhost/auth
Gehe ich zu http://localhost/auth/
und in meinem Chrome developer console sehe ich den Fehler: 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.
Mache ich einen view-source zu sehen, die folgenden:
<!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>
Gehe ich zu http://localhost/auth/channel.html
- und Sicht-Quelle zu sehen, die einzige Zeile:
<script src="//connect.facebook.net/en_US/all.js"></script>
Du musst angemeldet sein, um einen Kommentar abzugeben.
Sollten Sie verwenden einige alias-domain, wenn Sie eine Verbindung herstellen möchten Ihre Facebook-Anwendung mit Ihrer lokalen Umgebung.
Versuchen Sie Folgendes:
Gehen Sie zu Ihrem
etc/hosts
(oder%systemroot%/system32/drivers/etc/hosts
) - Datei und fügen Sie die folgende Zeile:127.0.0.1 foo.local # alias domain
Gehen
App > Settings
und registrieren Sie Ihre Anwendung, indem Sie einfach mitfoo.local
als app-Domäne.Fügen Sie Ihre Website-URL (z.B. http://foo.local/project/ )
Getan.
Bearbeitet am 16.01.2016:
Facebook hat sich verändert Ihr UI, befolgen Sie diese Schritte, um es arbeiten.
App > Settings > Basic (tab)
Add Platform
wählen Sie "Website" und geben Sie Ihren alias-domain.App Domain
Abschnitt.