【问题标题】:LinkedIn integration with scribeLinkedIn 与抄写员的集成
【发布时间】:2016-08-31 18:01:40
【问题描述】:

有人可以帮助在后端集成linkedIn。 问题来了,我有 oauth_token(已经用linkedIn javascript api响应),我想在后端使用这个令牌。

示例如下:

    OAuth20Service service = new ServiceBuilder()
        .apiKey(getLinkedInClientId())
        .scope("r_basicprofile r_emailaddress") // replace with desired scope
        .apiSecret(getLinkedInSecret())
        .build(LinkedInApi20.instance());

    try {
        OAuth2AccessToken accessToken = new OAuth2AccessToken(props.getToken(), "Bearer", 0, null, null, null);

        final OAuthRequest request = new OAuthRequest(Verb.GET, String.format("https://api.linkedin.com/v1/people/~"),
            service);
        request.addHeader("x-li-format", "json");
        request.addHeader("Accept-Language", "ru-RU");
        service.signRequest(accessToken, request);
        final Response response = request.send();
        String body = response.getBody();
        response.getMessage();

    } catch (Exception e) {
        e.printStackTrace();
    }

它总是说我的令牌无效。

{
  "errorCode": 0,
  "message": "Invalid access token.",
  "requestId": "OKZVL3STZK",
  "status": 401,
  "timestamp": 1472554177625
}

我也尝试使用 Apache oltu 客户端但没有运气(

好像我没有得到有效的令牌,因为当我使用https://apigee.com/console/linkedin 时一切都很好

【问题讨论】:

    标签: java oauth-2.0 linkedin scribe


    【解决方案1】:

    我使用的令牌不是 access_token,所以我选择使用 OAuth2 进行后端实现。

    【讨论】:

      猜你喜欢
      • 2011-09-29
      • 1970-01-01
      • 2015-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      相关资源
      最近更新 更多