create_oauth_token.js
function listLabels(auth) {
    var gmail = google.gmail('v1');
    gmail.users.labels.list({
        auth: auth,
        userId: 'me',
    }, function(err, response) {
        if (err) {
            console.log('The API returned an error: ' + err);
            return;
        }
        var labels = response.labels;
        if (labels.length === 0) {
            console.log('No labels found.');
        } else {
            console.log('Labels:');
            for (var i = 0; i < labels.length; i++) {
                var label = labels[i];
                console.log('- %s', label.name);
            }
        }
    });
}
function listLabels(auth) {
    var gmail = google.gmail('v1');
    gmail.users.labels.list({
        auth: auth,
        userId: 'me',
    }, function(err, response) {
        if (err) {
            console.log('The API returned an error: ' + err);
            return;
        }
        var labels = response.labels;
        if (labels.length === 0) {
            console.log('No labels found.');
        } else {
            console.log('Labels:');
            for (var i = 0; i < labels.length; i++) {
                var label = labels[i];
                console.log('- %s', label.name);
            }
        }
    });
}
function listLabels ( auth ) { var gmail = google . gmail ( 'v1' ) ; gmail . users . labels . list ( { auth : auth , userId : 'me' , } , function ( err , response ) { if ( err ) { console . log ( 'The API returned an error: ' + err ) ; return ; } var labels = response . labels ; if ( labels . length === 0 ) { console . log ( 'No labels found.' ) ; } else { console . log ( 'Labels:' ) ; for ( var i = 0 ; i < labels . length ; i ++ ) { var label = labels [ i ] ; console . log ( '- %s' , label . name ) ; } } } ) ; }
Lists the labels in the user's account.

@param {google.auth.OAuth2} auth An authorized OAuth2 client.
Lists the labels in the user s account .