LinkedIn API How to get Userinfo?

1.1k Views Asked by At

The problem is that I can't get my userinfo from the Linkedin API. I always get not enough permission to access:

GET /userinfo - status 403

I tried to make an API call to get my LinkedIn Userinfo like Firstname.

I have an LinkedIn App and Dev Account. I do the authorization and getting accestoken manual in the searchbar. I just fill out the missing parameters. After that i try to make an API call in Postman with the acces token. The Authorization with the scope - profile worked and i got an accestoken. But when I try to make an API call to https://api.linkedin.com/v2/userinfo in Postman with the Access Token in the Authorization Bearer. I only get this response:

"serviceErrorCode": 100,
    "message": "Not enough permissions to access: GET /userinfo",
    "status": 403" 

I only have the consumer free product - so I got share on LinkedIn and sign in with openid connect.

Still I don't know why I cannot get my profile information. Can someone tell me what im doing wrong after getting the accesstoken? Is there a better way to try to make an API call for userinfo? Or do i need other products and permissions? Thanks for Help :)

1

There are 1 best solutions below

0
Kkameleon On

You get this error because you don't have access to the "openid" scope. There are two steps:

1 - Get the authorization for that scope on your LinkedIn Developer Account by requesting the product " Sign In with LinkedIn using OpenID Connect". When this is done you should see this in the "Auth" tab: openid present under OAuth 2.0 scopes

2 - When you make a request to "https://www.linkedin.com/oauth/v2/authorization", "openid" should be one of the value of the scope parameter. (Scopes are separated by a space if you want to add several ones). So you the url would like https://www.linkedin.com/oauth/v2/authorization?scope=openid&...

Provided that you have completed both steps you can then make the same request you are making to the "userinfo" endpoint with your token and it should work.