I've been testing out the Opensocial API 1.0 and attempting to get a
contacts list from Yahoo and Google.
I've written the following code which acts on the OAuth redirect
returned from the third party after the user has authorised access:
OAuth3LeggedScheme scheme = (OAuth3LeggedScheme)
request.getSession().getAttribute(OAUTH_SCHEME);
Provider provider = (Provider)
request.getSession().getAttribute(OAUTH_PROVIDER);
Client client = null;
scheme.requestAccessToken(request.getParameter(OAUTH_TOKEN),request.getParameter(OAUTH_VERIFIER));
client = new Client(provider,scheme);
Response viewerResponse = client.send(PeopleService.getViewer());
List<? extends Model> items = viewerResponse.getEntries();
PrintWriter writer = new PrintWriter(response.getWriter());
String guid = items.get(0).getFieldAsString("id");
Response friendsResponse =
client.send(PeopleService.getFriends(guid));
List<Model> friends = friendsResponse.getEntries();
for(Model friend : friends) {
writer.println("Item:" + friend.toJSONString());
}
The first part that obtains the users details using the .getViewer()
method is ok however when I then attempt to obtain the user's friends
using .getFriends(guid) from Yahoo I get a 500 error and from Google I
get no items.
Can anyone help with this?
Cheers,
Jamez
--
You received this message because you are subscribed to the Google Groups "OpenSocial Client Libraries" group.
To post to this group, send email to opensocial-cl...@googlegroups.com.
To unsubscribe from this group, send email to opensocial-client-l...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opensocial-client-libraries?hl=en.