FB.api ('/ me') zawsze podaje kod błędu: 2500 w telefonie Android
Używam wtyczki facebook do logowania i wylogowywania użytkownika, które działają poprawnie. Problem polega na tym, że gdy żądam informacji o zalogowanym użytkowniku za pomocą funkcji FB.api („/ me”), zawsze pojawia się następujący błąd:
<code> {"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500} </code>
Użyłem trybu debugowania, aby sprawdzić PluginResult (pr) i JSONObject odpowiedzi. JSONObject zawiera informacje o użytkowniku, których potrzebowałem, nie rozumiem, co robię źle.
<code> Plz help...... </code>
MÓJ KOD:
<code> function login() { FB.login(function(response) { if (response.session) { console.log('Welcome! Fetching your information.... '); FB.api('/me', function(response) { console.log('Good to see you, ' + JSON.stringify(response) + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } },{scope: 'email,user_likes'}); } function logout() { FB.logout(function(response) { console.log(localStorage.getItem("user_fb_log_status")); localStorage.setItem("user_fb_log_status","LOGGED_OUT"); alert('logged out'); }); } The above code is working fine to login and logout the user. Below is the code i used to get the user details, function me() { FB.api('/me', { fields: 'id, name, picture' }, function(response) { if (response.error) { alert(JSON.stringify(response.error)); } else { var data = document.getElementById('data'); fdata=response.data; console.log("fdata: "+fdata); response.data.forEach(function(item) { var d = document.createElement('div'); d.innerHTML = "<img src="+item.picture+"/>"+item.name; data.appendChild(d); }); } }); } </code>