本文介绍了链接“此应用程序不允许创建应用程序令牌"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

我知道为了使用新的 Linkedin API(合作伙伴 API),我应该使用第一个 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}

回复:错误访问被拒绝"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}&state={STATERETURNED}

这将返回我用来发出令牌请求的代码(和状态):

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&client_id={MYCLIENTID}&client_secret={MYCLIENTSECRET}&redirect_uri={MYURIREDIRECT}&code={CODERETURNED}

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

解决方案

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

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

My main problem is getting the token. I can’t go further than this step.

In the Linkedin API's docs there are two ways described to obtain the token.Witch is the correct one?

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

I understand that in order to use the new Linkedin API (the partners one) I should use the first one (https://developer.linkedin.com/docs/v2/oauth2-client-credentials-flow)

Here is my petition:

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

The response:Error "access_denied"error_description "This application is not allowed to create application tokens"

And I get stuck here.

With the second one (https://developer.linkedin.com/docs/oauth2#configure) I actually get a token:https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id={MYCLIENTID}&redirect_uri={MYURIREDIRECT}&state={STATERETURNED}

This returns the code (and the State) which I use to make the token request:

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&client_id={MYCLIENTID}&client_secret={MYCLIENTSECRET}&redirect_uri={MYURIREDIRECT}&code={CODERETURNED}

And I get the token. But this isn’t the correct way to do it, is it?

解决方案

By default you will need to use the authorization_code flow to obtain an access token. Per the documentation the client_credentials flow is not enabled by default and needs to be specially enabled by LinkedIn.

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

这篇关于链接“此应用程序不允许创建应用程序令牌"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 04:02