2
我使用LinkedIn连接到我的应用程序。我需要userId,令牌和token_secret。我得到了两个令牌,但我无法获取当前登录的用户的ID!在Android应用上使用Linkedin成功登录后无法获取Linkedin ID?
该行:p.getId();
给我发送null。
这里我的代码:
String verifier = intent.getData().getQueryParameter("oauth_verifier");
LinkedInAccessToken accessToken = oAuthService.getOAuthAccessToken(liToken, verifier);
client = factory.createLinkedInApiClient(accessToken);
client.postNetworkUpdate("LinkedIn Android app test");
Person p = client.getProfileForCurrentUser();
System.out.println("TEST "+client.getProfileForCurrentUser());
System.out.println("Token "+accessToken.getToken());
System.out.println("Secret "+accessToken.getTokenSecret());
System.out.println("NOM "+p.getLastName() + ", PRENOM" + p.getFirstName());
Person profile = client.getProfileForCurrentUser(EnumSet.of(ProfileField.FIRST_NAME, ProfileField.LAST_NAME, ProfileField.CERTIFICATIONS_ID));
//System.out.println("IDDDDD"+profile.getId());
Connections connections = client.getConnectionsForCurrentUser();
System.out.println("Total connections fetched:" + connections.getTotal());
for (Person person : connections.getPersonList()) {
System.out.println(person.getId() + ":" + person.getFirstName() + " " + person.getLastName() + ":" + person.getHeadline());
}
帮助!谢谢!