How can I set

73 views
Skip to first unread message

Paul Taylor

unread,
Mar 24, 2014, 1:37:00 PM3/24/14
to signpos...@googlegroups.com
Hi, just trying to use SignPost with Oauth for the first time and I don't understand how to set the consumer,setTokenWithSecret() before signing

consumer.setTokenWithSecret(ACCESS_TOKEN, TOKEN_SECRET);

because I don't have ACCESS_TOKEN or TOKEN_SECRET ?


To clarify I have been provided with a consumer key and consumer secret key by the OAuth poviders (discogs,.com), I've successfully obtained a request token, the user has authorised access on a website
page and I have copied the verification code displayed into my applications user preferences

So now when I want to sign my urls I do the following

For a thread I create a consumer and retrieve the access code for the verification code
 
OAuthConsumer consumer = new DefaultOAuthConsumer(
DISCOGS_CONSUMER_KEY, DISCOGS_CONSUMER_SECRET);
OAuthProvider provider = new DefaultOAuthProvider(
"http://api.discogs.com/oauth/request_token",
"http://api.discogs.com/oauth/access_token",
"http://www.discogs.com/oauth/authorize");
provider.setRequestHeader("User-Agent", SongKong.USER_AGENT);
provider.retrieveAccessToken(consumer, UserPreferences.getInstance().getDiscogsAuthorization());
return consumer;

but I don't actually get an access code, its just populates the consumer object with it. So how do call setTokenWithSecret and what is the TOKEN_SECRET option, do I need to do this bit or can i just go ahead and do

consumer.sign(request);
 

thanks Paul
Reply all
Reply to author
Forward
0 new messages