i'm trying write sort of proxy able query google spreadsheet google chart api without giving rights directly spreadsheet people accessing visualization.
in order that, want replace calls like
var query = new google.visualization.query('http://spreadsheets.google.com/tq?key=the_key'); query.send(handlequeryresponse);
by calls of apps script proxy (with jsonp).
i wrote proxy following : (i'll add later option encapsulate result in function - jsonp)
function doget(e) { return contentservice .createtextoutput( urlfetchapp .fetch("http://spreadsheets.google.com/tq?tq="+e.parameter.q+"&key="+e.parameter.key)) .setmimetype(contentservice.mimetype.json); }
when trying response, obtain error : google.visualization.query.setresponse({"version":"0.6","status":"error","errors":[{"reason":"user_not_authenticated","message":"user not signed in","detailed_message":"\u003ca target=\u0022_blank\u0022 href=\u0022https://spreadsheets.google.com/spreadsheet/\u0022\u003esign in\u003c/a\u003e"}]});
like if user not authenticated. think it's weird because script deployed web app executed user, has rights on spreadsheet. guess must use oauth
, don't know how authenticate query way.
so question : how authenticate query apps script access data access rights defined when deploying web app ?
see urlfetch docs. missing oauth stuff. way doing work public ss.
Comments
Post a Comment