获取相册列表 Google Picasa

Get List of Albums Google Picasa

我正在开发一个从 Google Picasa 获取相册和图像的网络应用程序。

我一直收到 204,服务器没有内容响应。

此外,我收到错误消息:请求的资源上不存在 'Access-Control-Allow-Origin' header。

我在开发者控制台中拥有 javascript 来源的正确凭据,但我仍然收到此错误。我已经尝试了很多方法来制作请求,但是 none 已经成功了。

我已经使用 tokeninfo 端点验证了访问令牌,所以我相信我正在发出正确类型的请求。

这是我提出的要求:

    $.ajax({ //gives 204 no content response
                url: "https://picasaweb.google.com/data/feed/api/user/default", //use default to get current logged in user
                type: "GET",
                beforeSend: function(xhr){ //headers
                    xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);
                    xhr.setRequestHeader('GData-Version', '2');
                },
                dataType: "json",
                success: function(){
                    console.log("success");
                },
                fail: function(){
                    console.log("fail");
                }
            })
            .done(function(data){
                console.log(data);
            });

此外,发出 un-authenticated 请求:

                    $.ajax({ 
                url: "https://picasaweb.google.com/data/feed/api/user/default", //use default to get current logged in user
                type: "GET",
                dataType: "json",
                beforeSend: function(xhr){
                    xhr.setRequestHeader('GData-Version', 2);
                },
                success: function(){
                    console.log("success");
                },
                fail: function(){
                    console.log("fail");
                }
            })
            .done(function(data){
                console.log(data);
            });

Picasa 网络 API 对经过身份验证的请求进行 not support CORS。您必须从服务器而不是通过 JavaScript.

发出请求