开发者

Authentication required even with public Google Fusion Tables?

开发者 https://www.devze.com 2023-04-10 11:57 出处:网络
The Google Fusion Tables documentation claims that you don\'t need to authenticate to retrive data from public Fusion Tables.

The Google Fusion Tables documentation claims that you don't need to authenticate to retrive data from public Fusion Tables.

However, I'm trying to access a public Google Fusion Table with the following code, and getting an authentication error (Uncaught syntax error in line 1 of a file called ServiceLogin.)

function getData(table) {
    var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=';
    var queryUrlTail = '&jsonCallback开发者_如何学Python=?';
    var query = "SELECT x, y, z FROM " + table + " LIMIT 5000";
    var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
    var jqxhr = $.get(queryurl, dataHandler, "jsonp");
    return jqxhr;
}

I've also been looking at this question, which says that this URL is a public Fusion Table, but if I paste that URL into my browser I get asked for authentication. No matter how many times I authenticate and then retry the link in the browser, I get bounced back to login again.

I'm using this post as a guide, but it doesn't mention the need for authentication anywhere: so what am I doing wrong?


I faced the same issue, which I resolved by Authenticating first. It may not suite all contexts but if it does, it is simple to implement.

POST are used instead of GET, which allows to pass the authentication token.

Have a look at the getGAauthenticationToken function in the reply of this thread. Google apps script update fusion table from spreadsheet script.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消