用Linkedin Spring Boot Rest api登录

问题描述 投票:1回答:1

我无法使用Linkedin登录。我看到401错误代码。请帮我。我的代码:

  HttpResponse httpResponse = Request.Get("https://api.linkedin.com/v1/people/~?format=json")
            .setHeader("Host", "api.linkedin.com")//
            .setHeader("Connection", "Keep-Alive")//
            .setHeader("x-li-src", "msdk")//
            .setHeader("Authorization", "Bearer " + form.getToken())
            .execute().returnResponse();
java rest authentication oauth-2.0 linkedin-api
1个回答
0
投票

我已经测试了你的标题,对我来说,如果删除“x-li-src”标题,请求就可以了。用“x-li-src”我得到了

{
    "errorCode": 0,
    "message": "Unable to verify access token",
    "requestId": "XXXXXXXXX",
    "status": 401,
    "timestamp": 1551696403376
}

另请注意,Linkedin宣布其API的第1版将在2019年3月1日之后无效(尽管截至2019年3月4日仍然可用)。您应该迁移到API的第2版。

https://engineering.linkedin.com/blog/2018/12/developer-program-updates

© www.soinside.com 2019 - 2024. All rights reserved.