android – LinkedInCommunicationFailed

final LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerkeyvalue, consumerSecretValue);   
    LinkedInRequestToken requestToken = oauthService.getoAuthRequestToken();

我正在使用LinkedApi库,昨天这段代码正在运行,但今天我不知道为什么,但它给出了异常

LinkedInRequestToken requestToken = oauthService.getoAuthRequestToken();

它的给予:

com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider Failed: https://api.linkedin.com/uas/oauth/requestToken

解决方法:

解决了 –
我发布代码所以我所有的朋友都不需要挣扎

步骤1)使用API​​获取引脚

oauthService= LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerkeyvalue, consumerSecretValue);   
    requestToken= oauthService.getoAuthRequestToken();
    //requestToken=oauthService.getoAuthRequestToken();
    //getoAuthRequestToken(""); 
    autoToken= requestToken.getToken();  
    authoTokenSecret = requestToken.getTokenSecret();  
    authUrl= requestToken.getAuthorizationUrl();
    Log.i("Tok", autoToken);
    Log.i("Tok", authoTokenSecret);
    Log.i("Tok", authUrl);

    webview.loadUrl(authUrl);

步骤2)webview将在登录显示pin链接现在使用你的pin来获取访问令牌并使用访问令牌你可以获得配置文件和更新状态

String pin = pin_edit.getText().toString();
    System.out.println("Fetching access token from  LinkedIn...");        
    LinkedInAccesstoken accesstoken =  oauthService.getoAuthAccesstoken(requestToken, pin);
    System.out.println("Access token: " +  accesstoken.getToken());
    System.out.println("Token secret: " +  accesstoken.getTokenSecret());
    final LinkedInapiclientFactory factory =  LinkedInapiclientFactory.newInstance(consumerkeyvalue,  consumerSecretValue);
    final LinkedInapiclient client =  factory.createLinkedInapiclient(accesstoken);

    Person profile = client.getProfileForCurrentUser();
    profile.setCurrentStatus("Hello all my friends ,I am missing you all"); 
    client.updateCurrentStatus("Hello all going");

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...