Search code examples
google-apigoogle-api-clientpicasagoogle-photos

Picasa Web Albums REST API: 404 Unknown User issue


I'm trying to get the list of albums as it is written here: https://developers.google.com/picasa-web/docs/1.0/developers_guide_protocol#ListPhotos

GET https://picasaweb.google.com/data/feed/api/user/default Authorization: Bearer MY_ACCESS_TOKEN_HERE

So, the problem is that I get "404 Unknown user" responce. Strange thing but when I make the same request with the same access token from another PC, I get the correct responce (200 OK and list of albums).

I didn't google anything useful except the similar issue which was on API for Python (like here: AuthSub: (404, 'Not Found', 'Unknown user.')). Did anyone face the same issue?


Solution

  • So, the problem was that Google Photos server handles the requests incorrectly, if these requests contain some wrong Cookie headers. I say "incorrectly" because other Google APIs (like Drive, Contacts, etc.) didn't have this issue.

    So, all that I had to do is to add flag INTERNET_FLAG_NO_COOKIES in InternetOpenUrl function:

    InternetOpenUrl(NetHandle, PChar(Url), PChar(Header), Length(Header), INTERNET_FLAG_RELOAD or INTERNET_FLAG_NO_COOKIES, 0);
    

    After that sending HTTP requests using InternetOpenUrl with the flag won't return this error anymore.