Hi. I see all the examples using Basic authentication scheme of CalDav. Since Google Calendar does not support Basic and supports only OAuth2, is it possible to show some sample implementation of the same? I was trying to set it up but I keep getting status of undefined.
var dav = require('dav');
var xhr = new dav.transport.OAuth2(
new dav.Credentials({
clientId:"<my client id>",
clientSecret:"<my client secret>",
tokenUrl:"https://oauth2.googleapis.com/token",
redirectUrl: "http://localhost"
})
);
var client = new dav.Client(xhr);
client.createAccount({
server: 'https://apidata.googleusercontent.com/caldav/v2/vigneshviswam@gmail.com/user',
xhr: xhr
})
.then(function(account) {
console.log('account.addressBooks::', account.addressBooks);
account.addressBooks.forEach(function(addressBook) {
console.log('Found address book name ' + addressBook.displayName);
// etc.
});
});
// var req = dav.request.basic({
// method: 'PUT',
// data: 'BEGIN:VCALENDAR\nEND:VCALENDAR',
// etag: '12345'
// });
// xhr.send(req).then(function(resp) {
// console.log('resp:::', resp);
// }).catch(function(err){
// console.log('err:::', err);
// });
Hi. I see all the examples using Basic authentication scheme of CalDav. Since Google Calendar does not support Basic and supports only OAuth2, is it possible to show some sample implementation of the same? I was trying to set it up but I keep getting status of undefined.