I passed the request-authorize-access token stage, but when I try to
use my access token to Get some info, Unauthorized message was
returned by the service provider.
The accessor I am using to Get is newly created, so I tried this to
restore its data
ArrayList<Map.Entry<String, String>> params = new
ArrayList<Map.Entry<String, String>>();
OAuthClient oclient = new OAuthClient(new HttpClient4());
OAuthAccessor accessor = DBProvider.defaultAccessor(ctx); //
contains a well set up consumer which contains a provider
String[] defaultAccessToken = getDefaultAccessToken(ctx);
accessor.requestToken = getDefaultRequestToken(ctx)[0]; //
Authorized request token. Is this step necessary?
accessor.tokenSecret = defaultAccessToken[1]; // Is the access
token secret we got from converting authorized request token ?
accessor.accessToken = defaultAccessToken[0]; // access token
we got
from the converting authorized request token to access token
params.add(new OAuth.Parameter("oauth_token",
defaultAccessToken[0]));
try {
OAuthMessage omessage = oclient.invoke(accessor,
OAuthMessage.GET,
url, params); //OAuthException
return omessage.readBodyAsString();
}
As you can see, I store those data in a database and I verified all
data stored are the same as when I first got them back from the
service provider. So I have to manually reset the accessor because I
want to use it in a different class to access the protected material.
DId I miss anything so it doesn't work well? Any ideas would be great.
Thanks so much in advance!
Yefei
--
You received this message because you are subscribed to the Google Groups
"OAuth" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/oauth?hl=en.