我已经在我的机器上安装了docker + symfony4。我尝试实现facebook登录,为此我安装了ngrok,因为我对https遇到了一些问题,因此ngrok生成了此链接:https://f7f8d7d3.ngrok.io。我在这个网址中放入了Facebook developer应用
当我按下“使用Facebook登录”按钮时,出现错误: 不安全的登录被阻止:您无法从不安全的页面获取访问令牌或登录该应用。尝试将页面重新加载为https://
但是我在url中看到request_uri是旧主机: https://www.facebook.com/v2.8/dialog/oauth?response_type=code&client_id=634818730276116&state=73109d9bebdfd1670ccfff86702e001c&redirect_uri=http%3A%2F%project.loc%2Fsecured%2Flogin_facebook&display=popup&auth_type=rerequest
redirect_uri = http%3A%2F%project.loc
我不明白为什么。
我的意思
</form>
<div id="fb-root"></div>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '634818730276116', // App ID from the app dashboard
channelUrl : '//mysite.com/channel.html', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
};
// Load the SDK asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function fb_login() {
console.log("Facebook Login");
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
} else {
// not_authorized
FB.login(function(response) {
if (response.authResponse) {
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
}
}, {scope: 'email'});
}
});
}
</script>
所以想法是如何更改此request_uri,为什么是旧的?感谢您的帮助。提前谢谢,我的英语不好意思。没有人知道如何解决吗? :(