की संपत्ति 'userID' नहीं पढ़ सकता है मैं फेसबुक जावास्क्रिप्ट एसडीके का उपयोग कर प्राधिकरण सुविधा को लागू करने की कोशिश कर रहा हूं। जब मैं इसे चलाता हूं, तो यह कंसोल की जांच करता है और मुझे त्रुटि दिखाई देती है।फेसबुक जावास्क्रिप्ट एसडीके uncaught TypeError: अपरिभाषित
uncaught TypeError: Cannot read property 'userID' of undefined
कोड स्निपेट
<div id="fb-root"></div>
<!-- Load the Facebook JavaScript SDK -->
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
var appId = 'APP_ID';
var uid;
// Initialize the JS SDK
FB.init({
appId: '413026618765431',
cookie: true,
});
// Get the user's UID
FB.getLoginStatus(function(response) {
uid = response.authResponse.userID ? response.authResponse.userID : null;
});
function authUser() {
FB.login(function(response) {
uid = response.authResponse.userID ? response.authResponse.userID : null;
}, {scope:'email,publish_actions'});
}
</script>