I create a guideline for you how to create a authorization token by linkedin API
- client_id (Require)
- redirect_uri (Require)
- scope (Require)
- response_type (The response_type value is always be code for example
response_type: code
) - state (Random unique string read more in docs)
https://www.linkedin.com/oauth/v2/authorization?
response_type=code&
client_id=77*******oo&
redirect_uri=https://example.com/auth/linkedin/callback& state=RandomString&
scope=w_member_social,r_liteprofile
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=77*******oo&redirect_uri=http://localhost:3000/&state=foobar&scope=rw_organization_admin%20w_organization_social%20r_organization_social%20w_member_social%20r_member_social
Note: scope is allways convert to urlencoded without comman.
In the first step we recive two value code and state as responce by linkedin authorization API. We use code and state for step 2.
your response look like code vaild for 10 min or maybe less
http://localhost:3000/?code=AQRqdBOemLfrX_F1MPbWrzpEaLZC90QLyMiSmRz-rjqhWUp9eBVzNzvxGXzDC5pc2MINkmif4cY9tHqmHKvzEF9ZLvDRIqd6A_i-VT879D158uU1wNIt-w0d4gDlWmiHigqYsXQw0d4giHigqYsXQ&state=foobar
For step 2 we need code and state paste code in code section
https://www.linkedin.com/oauth/v2/accessToken?Content-Type=application/x-www-form-urlencoded&grant_type=authorization_code&code=AQRqdBOemLfrX_F1MPbWrzpEaLZC90QLyMiSmRz-rjqhWUp9eBVzNzvxGXzDC5pc2MINkmif4cY9tHqmHKvzEF9ZLvDRIqd6A_i-VT879D158uU1wNIt-w0d4gDlWmiHigqYsXQ&redirect_uri=http://localhost:3000/&client_id=77*******oo
After you recevice your access token and refresh token, test it with following curl command.
curl -H "Authorization: Bearer <token>" \
"https://api.linkedin.com/v2/me?projection=(id)"