I want to use Facebook SDK on Android to send Like statuses using Open Graph API. Described here: https://developers.facebook.com/docs/opengraph/actions/builtin/likes/
From SDK I got access_token (with publish_actions permission) using SSO. I already registred my app on Facebook Dev Account so I have my app_id.
Now I want to use Open Graph API to send Like status on my wall. So I call https://graph.facebook.com/MY_USER_ID/og.likes with access_token, app_id and object header (using setRequestProperty()) with HttpURLConnection and setRequestMethod to POST.
HttpURLConnection conn;
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("object", "someURL");
conn.setRequestProperty("app_id", "myID");
conn.setRequestProperty("access_token", "myToken");
conn.setRequestProperty("Content-Length", "" + postMessageInBytes.length);
I always get response 400 Bad Request
{"error":{"message":"An access token is required to request this resource.","type":"OAuthException","code":104}}
When I'm using Graph API Explorer (developers.facebook.com/tools/explorer/) everything works fine and there is no problem with access token.
When I debug my access token everything looks fine (translated from another language):
ID app: my app ID/name
ID user: user which I used to login
Issued: 1348929549 (yesterday)
Valid until: 1354113549 (in about 2 months)
Valid: True
Origin: Mobile Web Faceweb
Permission: publish_actions user_status
So the question is, where is the problem with access token?
Thanks for help!