darshb / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

com.google.HTTPStatus error 403 When retrieving existing Photo Albums #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I have attached my code where the issue occurs.  Unfortunately I don't 
understand enough about what is going wrong to give you definite steps to 
reproduce this problem.

What is the expected output? What do you see instead?

I have used the API to successfully get an oAuth 2 object.  I have then 
successfully retrieved all photo albums for the logged in user.  I would now 
like to retrieve all the photo data for each album, so that I can cache photos 
to the device, however when I attempt to retrieve the photo data, half the 
albums return com.google.HTTPStatus error 403.  From my understanding this is a 
does not exist error, which doesn't make sense given that I just retrieved the 
current list of albums for the user, and 4 of the albums seem to return without 
an error.

Here is the output from my attached code:

2011-12-02 09:13:52.530 TANConnectCards[11356:707] 
serviceBase:<GDataServiceGooglePhotos: 0x4ac590> objectFetcher:GTMHTTPFetcher 
0x490b40 
(https://photos.googleapis.com/data/feed/api/user/benjamin.smith.bts%40gmail.com
/albumid/5626290957485481921) failedWithStatus:403 data:
2011-12-02 09:13:52.534 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.535 TANConnectCards[11356:707] Large Images
2011-12-02 09:13:52.536 TANConnectCards[11356:707] #$@$#$!&@$*# Error
2011-12-02 09:13:52.542 TANConnectCards[11356:707] Error 
Domain=com.google.HTTPStatus Code=403 "The operation couldn’t be completed. 
(com.google.HTTPStatus error 403.)" UserInfo=0x27c800 {}
2011-12-02 09:13:52.543 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.545 TANConnectCards[11356:707] completed 1 out of 9 albums
2011-12-02 09:13:52.550 TANConnectCards[11356:707] 
serviceBase:<GDataServiceGooglePhotos: 0x492670> objectFetcher:GTMHTTPFetcher 
0x4930f0 
(https://photos.googleapis.com/data/feed/api/user/benjamin.smith.bts%40gmail.com
/albumid/5615573503987988737) failedWithStatus:403 data:
2011-12-02 09:13:52.551 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.553 TANConnectCards[11356:707] Thanksgiving
2011-12-02 09:13:52.554 TANConnectCards[11356:707] #$@$#$!&@$*# Error
2011-12-02 09:13:52.555 TANConnectCards[11356:707] Error 
Domain=com.google.HTTPStatus Code=403 "The operation couldn’t be completed. 
(com.google.HTTPStatus error 403.)" UserInfo=0x4a93c0 {}
2011-12-02 09:13:52.556 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.558 TANConnectCards[11356:707] completed 2 out of 9 albums
2011-12-02 09:13:52.625 TANConnectCards[11356:707] 
serviceBase:<GDataServiceGooglePhotos: 0x2764c0> objectFetcher:GTMHTTPFetcher 
0x276f30 
(https://photos.googleapis.com/data/feed/api/user/benjamin.smith.bts%40gmail.com
/albumid/5615586561578465697) failedWithStatus:403 data:
2011-12-02 09:13:52.627 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.629 TANConnectCards[11356:707] Swimming
2011-12-02 09:13:52.631 TANConnectCards[11356:707] #$@$#$!&@$*# Error
2011-12-02 09:13:52.633 TANConnectCards[11356:707] Error 
Domain=com.google.HTTPStatus Code=403 "The operation couldn’t be completed. 
(com.google.HTTPStatus error 403.)" UserInfo=0x4524b0 {}
2011-12-02 09:13:52.636 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.638 TANConnectCards[11356:707] completed 3 out of 9 albums
2011-12-02 09:13:52.649 TANConnectCards[11356:707] 
serviceBase:<GDataServiceGooglePhotos: 0x497270> objectFetcher:GTMHTTPFetcher 
0x497cf0 
(https://photos.googleapis.com/data/feed/api/user/benjamin.smith.bts%40gmail.com
/albumid/5614045704050023521) failedWithStatus:403 data:
2011-12-02 09:13:52.650 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.651 TANConnectCards[11356:707] Disney Movies
2011-12-02 09:13:52.653 TANConnectCards[11356:707] #$@$#$!&@$*# Error
2011-12-02 09:13:52.654 TANConnectCards[11356:707] Error 
Domain=com.google.HTTPStatus Code=403 "The operation couldn’t be completed. 
(com.google.HTTPStatus error 403.)" UserInfo=0x2630e0 {}
2011-12-02 09:13:52.655 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.656 TANConnectCards[11356:707] completed 4 out of 9 albums
2011-12-02 09:13:52.659 TANConnectCards[11356:707] 
serviceBase:<GDataServiceGooglePhotos: 0x278b30> objectFetcher:GTMHTTPFetcher 
0x2795a0 
(https://photos.googleapis.com/data/feed/api/user/benjamin.smith.bts%40gmail.com
/albumid/5614075507623611313) failedWithStatus:403 data:
2011-12-02 09:13:52.660 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.662 TANConnectCards[11356:707] Spectrum Games
2011-12-02 09:13:52.663 TANConnectCards[11356:707] #$@$#$!&@$*# Error
2011-12-02 09:13:52.664 TANConnectCards[11356:707] Error 
Domain=com.google.HTTPStatus Code=403 "The operation couldn’t be completed. 
(com.google.HTTPStatus error 403.)" UserInfo=0x269f30 {}
2011-12-02 09:13:52.665 TANConnectCards[11356:707] ****************
2011-12-02 09:13:52.666 TANConnectCards[11356:707] completed 5 out of 9 albums
2011-12-02 09:13:53.562 TANConnectCards[11356:707] completed 6 out of 9 albums
2011-12-02 09:13:53.818 TANConnectCards[11356:707] completed 7 out of 9 albums
2011-12-02 09:13:54.151 TANConnectCards[11356:707] completed 8 out of 9 albums
2011-12-02 09:13:54.664 TANConnectCards[11356:707] completed 9 out of 9 albums
2011-12-02 09:13:54.765 TANConnectCards[11356:707] finished

As you can see the first 5 albums fail, and the last 4 albums work fine.  All 
the albums in my account have "Only You" visibility, I can't see any 
differences in the albums that would cause some to fail and some to succeed.

What version of the product are you using? On what operating system?

I am using the latest build, Revision 712, running Xcode 4.2, iOS 5.0, on OSX 
10.6.8

Please provide any additional information below.

I realize that this may not be a defect with the library, but a defect with how 
I am using it.  There seems to be very little documentation that I can find on 
using this objective-c library specifically with the Photos service, & I am at 
a loss as to why this is not working.  Am I passing in the right albumID when I 
use gDataAlbum.GPhotoID on line 75?  I can't find the documentation that 
indicates what I should be using in this instance, so took a guess.  

Thanks a lot, I really appreciate you taking a look into this issue for me.

Sincerely,
Ben.

Original issue reported on code.google.com by benjamin...@gmail.com on 2 Dec 2011 at 2:37

Attachments:

GoogleCodeExporter commented 9 years ago
Towards the end of my code I am assuming that gDataPhoto.photoData contains the 
actual image data, is that correct?  Again, if you could point me to 
documentation for these classes that would be fantastic.

Thanks again,
Ben.

Original comment by benjamin...@gmail.com on 2 Dec 2011 at 2:43

GoogleCodeExporter commented 9 years ago
I have now changed the visibility of these albums to Public, so if you click on 
the link to the failed albums, you will see that they do in fact exist.

Original comment by benjamin...@gmail.com on 2 Dec 2011 at 2:49

GoogleCodeExporter commented 9 years ago
403 means "Forbidden", which typically indicates an authorization problem.

You should turn on http logging as mentioned in the GData library's 
introduction documentation, and examine the actual server requests and 
responses.

Your code is repeatedly creating service objects and authorization objects, but 
that is not how they are intended to be used. Just make one instance of the 
GData service for the application, and create one an authorization object for 
the user.

Documentation for the photos API is at 
http://code.google.com/apis/picasaweb/docs/2.0/developers_guide.html

The Objective-C GData library includes a GooglePhotosSample application which 
shows how to use the library to download and upload photos and videos.

The issue tracker is intended for filing bugs and feature requests. For support 
in using the library to write your application, please use the discussion 
groups rather than opening issues.

Original comment by grobb...@google.com on 3 Dec 2011 at 6:18

GoogleCodeExporter commented 9 years ago
Thanks for your help, I changed the code so the service object is implemented 
as a singleton, which fixed up the 403 errors I was seeing.

Cheers,
Ben.

Original comment by benjamin...@gmail.com on 5 Dec 2011 at 4:41