views:

55

answers:

2

I am calling

 service.insert(new URL(getContentFeedUrl()), newAttachment);

for Google sites file upload using MediaStreamSource in servlet and get following exception

com.google.gdata.util.ServiceForbiddenException: OK Not authorized to write to this feed

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:561)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:543)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:536)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:515)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:515)
at com.google.gdata.client.media.MediaService.insert(MediaService.java:390)
at morefile.UploadApp.uploadAttachment(UploadApp.java:95)
A: 

Do you call service.getAuthToken with good username and password before?

Dmitry
why will you need username and password when you are using authsub/oauth?
dhaval
I don't know what are you using, as you didn't say that in your question. But I see that you're getting authentication error and that there are a few authentication related methods in GoogleService class.
Dmitry
A: 

I just realised that i was granting access to user who was not owner of google sites and thus was getting this error. I am leaving this comment as there is little help available on web on this error.

dhaval