netzteil
netzteil

Reputation: 29

How to get an accessToken by linkedin

A client wants me to integrate his News from LinkedIn to his TYPO3 site.

Yes, I am one of more admins of the company page on linkedin, the app is verified by the client. I have client_id and client_secret

When i do the request to get an accessToken, something like:

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

the answer is error "access_denied" error_description "This application is not allowed to create application tokens"

I have no clue, what the necessary permissions are and where to set them. Neither the linkedin backend nor the developers shows up with any proper link. I know, this question has been asked before, but its about the permissions. Please set me on the rail...

Upvotes: 2

Views: 2238

Answers (2)

Frederik van Lierde
Frederik van Lierde

Reputation: 66

I use the .net Packages CodeHelper.API.LinkedIn

.NET using CodeHelper.API.LinkedIn;

LinkedInHelper _helper = new() {AccessToken = "{ACCESSTOKEN}" };
string _id = await _helper.GetAuthorID();

CURL curl -H "Authorization: Bearer "
"https://api.linkedin.com/v2/me?projection=(id)"

More Information

Upvotes: 0

Murilo
Murilo

Reputation: 659

You are trying to use the 2-legged OAuth process which is by "client credentials" unfortunately that process is not available by default to all applications which is probably why you are receiving that message.

This is mentioned in the first paragraph of the documentation of the 2-legged OAuth process.

Your application cannot access these APIs by default

https://learn.microsoft.com/en-us/linkedin/shared/authentication/client-credentials-flow?context=linkedin/context

Your application needs access to enterprise linkedin products that can perform API requests that are not member specific in order to be able to use that process.

By default the application only have access to the 3-legged process which involve a GET https://www.linkedin.com/oauth/v2/authorization before making a request to get access tokens.

More information about the 3-legged process can be found here

https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context

Upvotes: 2

Related Questions