【问题标题】:Connect to LinkedIn using Java and OAuth使用 Java 和 OAuth 连接到 LinkedIn
【发布时间】:2016-07-23 01:09:45
【问题描述】:

我使用了以下代码:

    String linkedinKey = "";    //add your LinkedIn key
    String linkedinSecret = ""; //add your LinkedIn Secret

    LinkedInOAuthService oauthService;
    LinkedInRequestToken requestToken;

    System.out.println("Fetching request token from LinkedIn...");  
    String authUrl = null;
    String authToken,authTokenSecret;

    oauthService= LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService("",""); 
    requestToken= oauthService.getOAuthRequestToken();
    authToken= requestToken.getToken();  
    authTokenSecret = requestToken.getTokenSecret();  

    System.out.println("Request token " +requestToken);

但是在执行之后我得到一个错误:

线程“主”java.lang.NoSuchMethodError 中的异常:oauth.signpost.OAuthProvider.retrieveRequestToken(Loauth/signpost/OAuthConsumer;Ljava/lang/String;)Ljava/lang/String; 在 com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:148)

我使用了 signpost-core-1.2.1.2 和 linkedin-j jar 文件。

请帮我看看我哪里做错了?

【问题讨论】:

    标签: java linkedin


    【解决方案1】:

    我想你已经下载了不同的 jars。使用来自https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/linkedin-j/linkedin-j-1.0.429-binary.zip 链接的 jar 重建您的项目(如果链接不起作用,请搜索 inkedin-j-1.0.429-binary.zip 或最新版本)。希望这会有所帮助。

    【讨论】:

    • 为我工作:)
    【解决方案2】:

    您实际上并没有将您的密钥和秘密设置为空字符串吗?

    String linkedinKey = ""; //add your LinkedIn key String linkedinSecret = ""; //add your LinkedIn Secret

    【讨论】:

    • 不,它不是空字符串,我已经设置了 LinkedIn 密钥和密码。
    猜你喜欢
    • 2017-02-07
    • 2019-05-29
    • 1970-01-01
    • 2015-08-11
    • 2012-10-17
    • 1970-01-01
    • 2011-01-19
    • 1970-01-01
    • 2023-03-27
    相关资源
    最近更新 更多