I have extracted the Google Calendar print request parameters so that they can be used to export or UrlFetchApp them using Apps Script
The parameters are listed below, When I access this URL via the signed in browser it displays events
But when I run the same via apps script, I get a calendar PDF without events.
How is the authorization is passed implicitly or explicitly? I had just passed Bearer
https://calendar.google.com/calendar/printable?psd=false
&ctz=Asia%2FCalcutta
&dates=20170507%2F20170520
&mode=month
&pbw=false
&pfs=NORMAL
&pft=pdf
&pgsz=a4
&pli=1
&po=PORTRAIT
&pred=20170520
&prsd=20170507
&psa=false
&psdec=false
&pset=false
&psr=false
&rand=-6094307348214370018#
&src=Y29mbS5lZHUuaW5fdWxoOHIza2Fyc2QyYnVzaDAzNG10OTIzbjRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ
In my Apps script,
//url specified as above
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + ScriptApp.getOAuthToken()
},
'followRedirects': true
});