I'm developing a web application that gets albums and images from Google Picasa.
I keep getting a 204, no content response from the server.
In addition, I am getting the error: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I have the proper credentials in the developer console for javascript origins, and yet I still am getting this error. I have tried many ways to craft the request, but none have been successful.
I have verified the access token using the tokeninfo endpoint, so I believe I am making the right type of requests.
Here is the request I am making:
    $.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);
            });
Also, making an un-authenticated request:
                    $.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);
            });
The Picasa Web API does not support CORS for authenticated requests. You will have to make your requests from a server instead of via JavaScript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With