aboutsummaryrefslogtreecommitdiff
path: root/oauth.js
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-01-23 23:07:25 -0500
committerDeterminant <[email protected]>2019-01-23 23:07:25 -0500
commit9eec5b0d0ca748a73abe23511688bbba9b906c22 (patch)
tree48f610df290336edae8a620d945f8cc156e34a89 /oauth.js
parent4ef8618ffba5a66fea2020f367f5533efeaa5b0c (diff)
figure out how to do oauth2 and access Google Calendar data
Diffstat (limited to 'oauth.js')
-rw-r--r--oauth.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/oauth.js b/oauth.js
new file mode 100644
index 0000000..96ae811
--- /dev/null
+++ b/oauth.js
@@ -0,0 +1,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);
+ });
+ });
+ });
+};