Androidプロジェクトでバージョン1.0.429のlinkedin-j-android.jarを使用しました
これは、パッチを適用したlinkedin-j-android.jarをスコープ修正付きでダウンロードするためのリンクです http://db.tt/yQjhqeq3 以下は、私のプロジェクトで使用したコードです:
class ShowNetWorkUtils{
public static final String CONSUMER_KEY = "xxxxx";
public static final String CONSUMER_SECRET = "yyyy";
public static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin";
public static final String OAUTH_CALLBACK_HOST = "calback";
public String scopeParams="rw_nus+r_baseprofile";
public static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME
+ "://" + OAUTH_CALLBACK_HOST;
private void configureLinkedIn() {
new Thread(){
@Override
public void run() {
try {
Looper.prepare();
LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService (CONSUMER_KEY,CONSUMER_SECRET,scopeParams);
LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(CONSUMER_KEY,CONSUMER_SECRET);
LinkedInRequestToken liToken = oauthService.getOAuthRequestToken(OAUTH_CALLBACK_URL);
//LinkedInRequestToken liToken = oauthService.getOAuthRequestToken();
String url = liToken.getAuthorizationUrl();
/* For Linkedin dialog create and show */
LKDialog lkdDialog = new LKDialog(_context, url);
LKDialog lkdDialog.setDelegate(ShowNetWorkUtils.this);
LKDialog lkdDialog.show();
Looper.loop();
}
catch (Exception e) {
e.printStackTrace();
}
} //End run
}.start();
}
} //End Class
「oauthService.getOAuthRequestToken(OAUTH_CALLBACK_URL)」行でトークンをリクエストすると例外が発生し、「oauthService.getOAuthRequestToken()」も使用しましたが、この場合も同じ例外が発生します。
例外は次のとおりです: com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: サービス プロバイダーとの通信に失敗しました: https://api.linkedin.com/uas/oauth/requestToken?scope =rw_nus+r_baseprofile
これを解決するための解決策を教えてください..