aboutsummaryrefslogblamecommitdiff
path: root/oauth.js
blob: 96ae8118c02df4d0120148c23b91c7f2f08d3f4e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                                                             
window.onload = function() {
    chrome.identity.getAuthToken({interactive: true}, function(token) {
        fetch('https://www.googleapis.com/calendar/v3' + '/users/me/calendarList' + '?access_token=' + token,
            { method: 'GET', async: true }).then((response) => response.json()).then(function(data) {
                var test = document.getElementById('test');
                data.items.map(e => e.summary).forEach(function(e) {
                    var entry = document.createElement('li');
                    entry.innerText = e;
                    test.appendChild(entry);
                });
            });
    });
};