curloauth-2.0google-reader

POST request to Google Reader (mark as readed)


I'm trying to mark an item as read on Google Reader using cURL and PHP. I'm requesting Google Reader permission for my application using OAuth 2.0. When I tried to mark an item as read, got the "400 Bad Request" HTTP error, my request looks like:

URL: https://www.google.com/reader/api/0/edit-tag

URL Params:

[client] => scroll

POST Params:

[i] => tag:google.com,2005:reader/item/b25079e56615b397
[s] => feed/http://christophertimberlake.com/rss
[async] => true
[T] => <Access token got on OAuth2 sign-in>
[a] => user/<user-id>/state/com.google/read

Request headers:

[Host] => www.google.com
[Accept] => */*
[Authorization] => Bearer <OAuth2 access token>
[Referer] => http://www.google.com/reader/view/
[User-Agent] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0
[Content-Length] => 247
[Content-Type] => application/x-www-form-urlencoded

Also, I'm noticed a strange response header from Google: X-reader-google-bad-token: true. Is this header related to the token sent by POST, do I have to use the OAuth2 token as POST parameter or I need another token?

Please note that I was successful to perform read-only request like get subscriptions, items list or read count information.

Does anyone know what's going on here?


Solution

  • I solved my problem, using OAuth2 I need also an action token to perform non read-only operations.

    See more

    https://groups.google.com/forum/?fromgroups=#!topic/fougrapi/U_8eT4yyLsY