Search code examples
androidgdatapicasa

Can get Picasa feeds, can upload and download - can't delete


I'm using Yaniv Inbar's GData client to access Picasa albums from an Android app. I authenticate via

AccountManager.getAuthToken(account, "lh2", null, activity, null, null);

and can get user and album feeds, and download and upload pictures. What I can't do is PicasaClient.executeDelete(Entry) - it keeps giving me a 403 error, despite using the exact same authentication that the getFeed and upload/download ops use.

Do I need to set client_id and client_secret for delete but not get/put? If so, where? Authenticating to OAuth2 Services shows

URL url = new URL("https://www.googleapis.com/tasks/v1/users/@me/lists?key=" + your_api_key);
URLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("client_id", your client id);
conn.addRequestProperty("client_secret", your client secret);
conn.setRequestProperty("Authorization", "OAuth " + token);

but I don't see URLConnection anywhere in the stack. I'm guessing that the hook will be somewhere in

authToken = authBundle.getString(AccountManager.KEY_AUTHTOKEN);
ClientLogin.Response clientLogin = new ClientLogin.Response();
clientLogin.auth = authToken;

... but it's not exactly obvious where.


Solution

  • Sigh. This was 100% iatrogenic.

    I created the Entry with an "edit" Link like

    https://picasaweb.google.com/data/entry/api/user/%s/albumid/%s/photoid/%s
    

    but set the etag to null because the etags I get in the album feed seem to be truncated somehow.

    As soon as I replaced

    photoEntry.etag = null;
    

    with

    photoEntry.etag = "*";
    

    all was well.