How to get Facebook access token from Graph API Javascript SDK? -


i'm trying alert access_token simple function i'm getting undefined i'm following syntax maybe i'm doing wrong?

javascript

   function logme() {       fb.login(function(){       fb.api('/me/accounts', {fields: 'access_token'}, function(response) {       var accesstoken = response.data.access_token;       alert(accesstoken);         } );     }, {scope: 'manage_pages'});     } 

with /me/accounts, array of pages manage - not 1 entry:

fb.api('/me/accounts', {fields: 'access_token'}, (response) => {     if (response && response.data) {         (let = 0, count = response.data.length; < count; i++ {             console.log(respose.data[i].access_token);         }     } }); 

this api endpoint access token specific page:

/[page-id]?fields=access_token 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -