I am getting undefined error in labels whenever I am trying to access list of label in gmail API

119 Views Asked by At
function listLabels(userId, callback) {
    var request = gapi.client.gmail.users.labels.list({   
        'userId': 'me'
    });
    request.execute(function(resp) {
        var labels = resp.labels;                 
        console.log(labels);                      
        // callback(labels)
    });
}

The request object accessed is made for labels but when labels is logged it returns undefined.

0

There are 0 best solutions below