问题
I am trying to integrate my website with facebook login. I have followed all the documentation provided by Facebook (Quick Start). Here is my code
function init() {
function checkLoginState() {
FB.getLoginStatus(function(response) {
if(response.status=="connected"){
var fbUser = response.authResponse.userID;
var fbAccess = response.authResponse.accessToken;
var data = new FormData();
data.append('fbUser',fbUser);
data.append('fbAccess',fbAccess);
callAjax('dologinfacebook',data);
}
});
}
checkLoginState();
}
window.fbAsyncInit = function() {
FB.init({
appId : 'myappid',
xfbml : true,
version : 'v3.0'
});
init();
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
It works great, I receive the response without any problem but at the end of my console. I receive this following error.
B5sq21HbPZ9.js:44 Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
at a (B5sq21HbPZ9.js:44)
at a (B5sq21HbPZ9.js:121)
at x (B5sq21HbPZ9.js:193)
at Object.b.post [as log] (B5sq21HbPZ9.js:193)
at a.logVital (B5sq21HbPZ9.js:219)
at B5sq21HbPZ9.js:293
at Array.forEach (<anonymous>)
at IntersectionObserver.f.threshold (B5sq21HbPZ9.js:293)
Anyone can suggest me what should I do to remove this following error? Thank you.
回答1:
It is a known bug: https://developers.facebook.com/support/bugs/1337180213092053/
Subscribe to it if you want to know when it is solved.
回答2:
There is a temporary solution for you, if you can have a separate link/button to logout. You can logout from this separate button using facebook api like:-
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// Logged into your app and Facebook.
FB.logout(function(response) {
//Person is now logged out
});
}
});
And you can turn off auto logout link from facebook login button like this data-auto-logout-link="false":-
<div class="fb-login-button" data-width="10" data-max-rows="1" data-size="large" data-scope="email,public_profile" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="true" data-use-continue-as="true" >
<div class="fb-login-button" data-width="10" data-max-rows="1" data-size="large" data-scope="email,public_profile" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="false" data-use-continue-as="true" >
来源:https://stackoverflow.com/questions/50890698/uncaught-error-minified-exception-occurred-facebook-login