I need your help!.
Im trying to insert a new photo into a Picasa Album using Oauth 2.0 and a simple HttpRequest process. The result is that I cant insert a new photo into my Picasa web album after following the instructions listed on: https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol#Auth I also have to say that I tried using the .Net library that they provide with the same results. The implementation that I'm using now is the following: public static string PostImage( string streamImageConvertedToString) { string url = string.Format("https://picasaweb.google.com/data/feed/api/user/{0}/albumid/{1}", "[email protected]", "idAlbum"); HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.ContentType = "image/jpeg"; request.ContentLength = Encoding.UTF8.GetByteCount(data); request.Method = "POST"; request.Headers.Add("GData-Version", "2"); request.Headers.Add("Slug", "cute_baby_kitten.jpg"); request.Headers.Add("Authorization", "Bearer " + GetToken()); if (data != null) { using (StreamWriter writer = new StreamWriter(request.GetRequestStream())) { writer.Write(data); } } HttpWebResponse response = request.GetResponse() as HttpWebResponse; string result = string.Empty; using (StreamReader reader = new StreamReader(response.GetResponseStream())) { result = reader.ReadToEnd(); } return result; } private static string GetToken() { const string ServiceAccountEmail = "[email protected]"; var servicio = new PicasaService(null); var certificate = new X509Certificate2(HttpContext.Current.Server.MapPath("/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."); return credential.Token.AccessToken; } -- 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.
