我已经阅读了很多关于LinkedIn登录的问题/答案,通过javascript登录和后端的用户验证。但是我没有找到与当前API兼容的解决方案。
我知道JS令牌和Oauth令牌不一样,我不需要保存令牌供将来使用,我只需要在网站上注册之前验证用户。
用户通过身份验证后,我将请求基本配置文件user和api-standard-profile-request
IN.API.Profile("me").fields(
'id', 'first-name', 'last-name', 'email-address', 'api-standard-profile-request')
apiStandardProfile返回一个带有url的对象(像这样的https://api.linkedin.com/v1/people/{id_user}
)和一个带有头的数组(像这样的name: "x-li-auth-token", value: "name:xxxx"
)。我还没有在官方文档中找到如何使用它,但每次我都会收到"Authentication Failed“和状态代码200。
那么,我是否需要用Oauth2.0重写身份验证流程,或者我可以继续使用Javascript登录吗?
谢谢
附言:我找到并阅读了这个老话题https://web.archive.org/web/20141028192415/https://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens中的旧文档。
发布于 2018-01-16 11:21:12
我也遇到过同样的问题,我发现使用JS令牌的唯一方法是在使用Rest API请求内容时使用头oauth_token而不是Authorization header头:
POST https://api.linkedin.com/v1/people/~:(id,firstName,lastName,picture-url,email-address)?format=json
Headers {
'oauth_token': JS_TOKEN
}
我在前端阅读的来自IN.ENV.auth.oauth_token.的JS_TOKEN
发布于 2017-08-08 08:05:34
我也遇到了很多LinkedIn API的问题,我建议你遵循LinkedIn开发者网站上的最新开发文档,因为LinkedIn在2015年2月之后更改了他们的开发程序significantly,所以依赖于,旧的API将是一个有风险的。
我相信下面的内容会帮助你解决这些问题,
配置文件接口支持的
如果您只需要公有配置文件,请在接口中添加此public-profile-url
作为逗号分隔参数。
https://api.linkedin.com/v1/people/~:(id,num-connections,picture-url,public-profile-url)?format=json
或者对于siteStandardProfileRequest,使用以下API:
https://api.linkedin.com/v1/people/~?format=json
OAuth vs Javascript SDK:
Javascript SDK
OAuth
https://stackoverflow.com/questions/45279081
复制