0

我在我的android项目中使用了1.0.429版的linkedin-j-android.jar

这是下载带有范围修复 http://db.tt/yQjhqeq3的已修补linkedin-j-android.jar的链接, 下面是我在项目中使用的代码:

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

请为我提供一些解决方案来解决这个问题..

4

1 回答 1

0

替换代码中的以下行

  public String scopeParams="rw_nus+r_baseprofile";    

   public String scopeParams="rw_nus+r_basicprofile";

因为权限范围是r_basicprofile但是你写成r_baseprofile

希望它会帮助你。

于 2012-11-28T07:29:48.453 回答