We have a problem with the new authentication PicasaWeb

We are using this code in C # .NET 2012 ( Framework 4.5.1 )

const string ServiceAccountEmail = 
"[email protected]";var certificate = new 
X509Certificate2(@"C:\key.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);
requestFactory.CustomHeaders.Add("Gdata-version: 2");PicasaService service = 
new PicasaService("api-project");
service.RequestFactory  = requestFactory;PhotoQuery query = new 
PhotoQuery(PicasaQuery.CreatePicasaUri(_IdUsuari, _albumid));PicasaFeed feed = 
service.Query(query);

We have an error to retrieve the PicasaFeed : Unhandled Exception: 
Google.GData.Client.GDataRequestException: Execution of aut hentication 
request returned unexpected result: 404

We've done every step of the link : *Google.GData.Client.GDataRequestException 
- Authentication suddenly fails in old code* 
<http://stackoverflow.com/questions/30469058/google-gdata-client-gdatarequestexception-authentication-suddenly-fails-in-old>
 
But it has not worked , is that we are using 4.5.1 and not 4.5 ?

We have done some testing generating the token from the page of Google : 
*https://developers.google.com/oauthplayground* 
<https://developers.google.com/oauthplayground>

We selected Picasa Web API v2 with the scope: 
*https://picasaweb.google.com/data/* <https://picasaweb.google.com/data/>

This has generated a token. We have marked the "Auto -refresh the token 
before it expires" option as it expires in 3600 seconds . The question is 
whether this token changes after 3600 seconds? . With the token generated 
from this link we have replaced the previous code , where " 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " is the token generated :

var requestFactory = new GDataRequestFactory(null);
requestFactory.CustomHeaders.Add("Authorization: Bearer " + 
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
requestFactory.CustomHeaders.Add("Gdata-version: 2");PicasaService service = 
new PicasaService("api-project");
service.RequestFactory  = requestFactory;PhotoQuery query = new 
PhotoQuery(PicasaQuery.CreatePicasaUri(_IdUsuari, _albumid));PicasaFeed feed = 
service.Query(query);

And with this token if it works. Any thoughts that the first code generated 
by the token code is not working properly for generating tokens and 
readings to Picasa. Does anyone have any solution?

Thank you very much

-- 
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