SignPost OAuthConsumer is not serializable

90 Views Asked by At

I'm using SignPost with Java to do a 3-legged OAuth integration. Most of the examples I see use Servlet sessions to preserve the OAuthConsumer across multiple requests, but that's not feasible for us because we use Hazelcast to manage a multi-clustered environment.

"No problem, I'll just use Hazelcast to stash the OAuthConsumer across requests." But when I try to do this I get an Exception:

Caused by: java.io.NotSerializableException: oauth.signpost.http.RequestParameters

Like I said, this is a 3rd Party library so I can't modify it but I do see that OAuthConsumer extends Serializable... so I'm not sure what the problem is.

Has anyone else encountered this problem and been able to work around it?

1

There are 1 best solutions below

1
On

After poking around the API we realized we could reconstruct the object if we just used Hazelcast to persist the temporary token and secret.

The calls are:

OAuthConsumer oauthConsumer = new DefaultOAuthConsumer(myAppConsumerKey, myAppConsumerSecret);
oauthConsumer.setTokenWithSecret(temporaryToken, tokenSecret);