Having an OAuth problem accessing picasaweb after setting what I think is all the correct parms

2 views
Skip to first unread message

nPn

unread,
Aug 4, 2009, 11:25:52 PM8/4/09
to Signpost users
After running thru the OAuth process, I got back a bunch of parms. I
then used them in my application but got a taceback. Here is the code
and the trace back, any idea what I am doing wrong.

BTW ... I am not sure if any of these tokens need to be protected, so
I just replaced the actual info with "blah...."


try {
PicasawebService myService = new PicasawebService
("myPgm");
OAuthParameters oauthParms = new OAuthParameters();
oauthParms.setOAuthToken("blah.......");
oauthParms.setOAuthTokenSecret("blah.....");
oauthParms.setOAuthConsumerKey("anonymous");
oauthParms.setOAuthConsumerSecret("anonymous");



try {
myService.setOAuthCredentials(oauthParms, null);
} catch (OAuthException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}


// } catch (AuthenticationException ex) {
// Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
// }
URL feedUrl = null;
try {
feedUrl = new URL("http://picasaweb.google.com/data/
feed/api/user/myId?kind=album");
} catch (MalformedURLException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}
UserFeed myUserFeed = null;
try {
myUserFeed = myService.getFeed(feedUrl,
UserFeed.class); // <- this is the line the generates the traceback
} catch (IOException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
} catch (ServiceException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at
com.google.gdata.client.authn.oauth.OAuthHelper.addCommonRequestParameters
(OAuthHelper.java:636)
at
com.google.gdata.client.authn.oauth.OAuthHelper.getAuthorizationHeader
(OAuthHelper.java:552)
at com.google.gdata.client.GoogleAuthTokenFactory
$OAuthToken.getAuthorizationHeader(GoogleAuthTokenFactory.java:199)
at com.google.gdata.client.http.HttpGDataRequest.<init>
(HttpGDataRequest.java:316)
at com.google.gdata.client.http.GoogleGDataRequest.<init>
(GoogleGDataRequest.java:436)
at com.google.gdata.client.http.GoogleGDataRequest
$Factory.createRequest(GoogleGDataRequest.java:73)
at com.google.gdata.client.http.HttpGDataRequest
$Factory.getRequest(HttpGDataRequest.java:161)
at com.google.gdata.client.Service.createRequest(Service.java:
678)
at com.google.gdata.client.GoogleService.createRequest
(GoogleService.java:525)
at com.google.gdata.client.Service.createFeedRequest
(Service.java:1055)
at com.google.gdata.client.Service.getFeed(Service.java:896)
at com.google.gdata.client.GoogleService.getFeed
(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:916)

matthias

unread,
Aug 5, 2009, 4:41:32 AM8/5/09
to Signpost users
that code snippet doesn't contain anything related to Signpost. What
exactly is your question? Are you using both Signpost and GData OAuth
at the same time? I don't believe that's necessary. For questions
related to Google Services, please turn to the respective groups (e.g.
http://groups.google.com/group/google-help-dataapi for GData).

You only need to use Signpost if you want to stay independent of any
service specific code, e.g. for doing mashups. If you link code
intended for a specific service (such as Picasaweb) that already
includes authentication based on OAuth, then there is no real need to
use Signpost at all (because it does the same thing). In fact you may
be better off not using it since it's not guaranteed to work, while a
Google specific solution very likely will work with a Google API.

In other words, if you must only access Google services, have a look
at this:
http://code.google.com/apis/gdata/articles/oauth.html

HTH
Matthias

nPn

unread,
Aug 5, 2009, 8:41:38 AM8/5/09
to Signpost users
Ok thanks for the pointers. On my initial look thru the picasa and
google account stuff, I saw the second link you pointed to but it
seemed very generic and could not find any java api. I stumbled on
signpost and it looked like it did what I wanted. From your first
link I found the OAuthHelper class which I think is what I was really
looking for in the first place. Sorry for the confusion.
John

On Aug 5, 4:41 am, matthias <m.kaepp...@googlemail.com> wrote:
> that code snippet doesn't contain anything related to Signpost. What
> exactly is your question? Are you using both Signpost and GData OAuth
> at the same time? I don't believe that's necessary. For questions
> related to Google Services, please turn to the respective groups (e.g.http://groups.google.com/group/google-help-dataapifor GData).
Reply all
Reply to author
Forward
0 new messages