App Domains: localhost
Website with Facebook login: http://localhost/auth
tôi đi đến http://localhost/auth/
và trong phát triển giao diện điều khiển Chrome của tôi, tôi thấy lỗi: 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.
Tôi đang làm gì sai trong phát triển ứng dụng Facebook cục bộ?
tôi làm một cái nhìn mã nguồn để thấy như sau:
<!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>
tôi đi đến http://localhost/auth/channel.html
và xem nguồn để xem một dòng:
<script src="//connect.facebook.net/en_US/all.js"></script>
Vì đồng hồ SO sẽ không cho phép tôi chỉnh sửa câu trả lời, tôi sẽ đăng phần chính xác làm nhận xét: Vấn đề là tại một thời điểm nào đó, tôi đã đặt URI chuyển hướng OAuth hợp lệ trong Cài đặt nâng cao thành thứ gì đó khác nhau và đã ghi đè tất cả các cài đặt khác. Làm trống trường đó đã khắc phục được sự cố, nhưng tất nhiên sửa lỗi đúng sẽ là đặt trường đó thành URL cụ thể mà tôi muốn nhận mã thông báo truy cập tại. – necromancer
Câu trả lời tuyệt vời! – user123
Ngoài ra, nếu bạn đang sử dụng cổng tùy chỉnh, ví dụ: 127: 0.0.1: 8080, đối với tôi nó chỉ hoạt động khi tôi thêm cổng vào dấu gạch ngang ứng dụng của Facebook. Vì vậy, trong/etc/hosts 127.0.0.1, nhưng trong FB: 127.0.0.1:8080 – willdanceforfun