linkedin"此应用程序不允许创建应用程序令牌"

时间:2018-05-31 14:18:22

标签: api token linkedin access-token linkedin-api

我的主要问题是获取令牌。我不能超越这一步。

在Linkedin API的文档中,描述了两种获取令牌的方法。 女巫是正确的吗?

1)https://developer.linkedin.com/docs/v2/oauth2-client-credentials-flow 2)https://developer.linkedin.com/docs/oauth2#configure

据我所知,为了使用新的Linkedin API(合作伙伴之一)我应该使用第一个(https://developer.linkedin.com/docs/v2/oauth2-client-credentials-flow

这是我的请愿书:

https://www.linkedin.com/oauth/v2/accessToken?grant_type=client_credentials&client_id= {MYCLIENTID}&安培; client_secret = {MYCLIENTSECRET}

回应: 错误" access_denied" error_description"此应用程序不允许创建应用程序令牌"

我被困在这里。

使用第二个(https://developer.linkedin.com/docs/oauth2#configure)我实际上得到一个令牌: https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id= {MYCLIENTID}&安培; REDIRECT_URI = {MYURIREDIRECT}&安培;状态= {STATERETURNED}

这将返回用于发出令牌请求的代码(和State):

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&client_id= {MYCLIENTID}&安培; client_secret = {MYCLIENTSECRET}&安培; REDIRECT_URI = {MYURIREDIRECT}&安培;代码= {CODERETURNED}

我得到了令牌。但这不是正确的做法,是吗?

1 个答案:

答案 0 :(得分:7)

默认情况下,您需要使用authorization_code流来获取访问令牌。根据文档,默认情况下不启用client_credentials流,需要由LinkedIn专门启用。

https://developer.linkedin.com/docs/v2/oauth2-client-credentials-flow