I have been using the picasa client login for a couple of years without 
issue.  We use it to store photos that users upload so we do not want to 
request for user authentication as we are just storing the photos in our 
own account.  It is developed in .NET.

 

Up until today it has worked and I can’t work out (and beginning to wander 
whether it is now possible) how to fix the issue.

 

*Previous Code:*

 

PicasaService service = new PicasaService("My App");

service.setUserCredentials("[email protected]", "password");

 

Uri postUri = new Uri(PicasaQuery.CreatePicasaUri("default", AlbumID));

string sContentType = "image/jpeg";

                    

 

PicasaEntry entry = (PicasaEntry)service.Insert(postUri, fileStream, 
sContentType, sFilename);

 

fileStream.Close();

 

sPicasaURL = entry.Media.Content.Url.ToString();

 

*NEW CODE (that doesn’t work!)*

 

Uri postUri = new Uri(PicasaQuery.CreatePicasaUri("default", AlbumID));

 

const string ServiceAccountEmail = "[email protected]";

 

var certificate = new X509Certificate2(HttpContext.Current.Server.MapPath(
"bin/key2.p12"), "notasecret", X509KeyStorageFlags.Exportable);

 

var serviceAccountCredentialInitializer = new ServiceAccountCredential.
Initializer(ServiceAccountEmail)

                    {

                        Scopes = new[] { 
"https://picasaweb.google.com/data/"; }

                    }.FromCertificate(certificate);

 

var credential = new ServiceAccountCredential
(serviceAccountCredentialInitializer);

 

if (!credential.RequestAccessTokenAsync(System.Threading.CancellationToken
.None).Result)

                    throw new InvalidOperationException("Access token 
request failed.");

 

                var requestFactory = new GDataRequestFactory(null);

                requestFactory.CustomHeaders.Add("Authorization: Bearer " + 
credential.Token.AccessToken);

 

 

                PicasaService service = new PicasaService("My App");

                service.RequestFactory = requestFactory;

 

                string sContentType = "image/jpeg";

 

PicasaEntry entry = (PicasaEntry)service.Insert(postUri, fileStream, 
sContentType, sFilename);

 

                    fileStream.Close();

 

                    sPicasaURL = entry.Media.Content.Url.ToString();

 

 

Please can you let me know why this doesn’t work?  I simply get :

 

"The remote server returned an error: (404) Not Found." error.  

{"Execution of request failed: 
https://picasaweb.google.com/data/feed/api/user/default/albumid/myalbumid"}

 

 

Is this type of login even now possible with the clientlogin deprecated?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-picasa-data-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to