Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Linkedin API : No refresh token with accessToken

When i use the Linkedin API to get access token, it only works halfway. According to the documentation, I’m supposed to receive :

  • access_token
  • expires_in
  • refresh_token
  • refresh_token_expires_in
  • scope.

But i only receive access_token, expires_in and scope?

Does anyone know why ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks

const data = {
    grant_type: "authorization_code",
    code,
    redirect_uri,
    client_id,
    client_secret: process.env.LINKEDIN_CLIENT_SECRET,
  }

const authorization = await axios.post(
    `https://www.linkedin.com/oauth/v2/accessToken?${querystring.stringify(data)}`);

console.log("authorization.data", authorization.data);

Logs :

authorization.data {
  access_token: 'AQX09XfxIcceXWHz9Mutkbjfsj3iqJptsAxrpGxW3anWD-rIh...,
  expires_in: 5183999,
  scope: 'r_liteprofile,w_member_social'
}

>Solution :

In your application, you need to enable programmatic refresh tokens for partners. if that is not available you will need to go through the authorization flow again to generate a refresh token. https://learn.microsoft.com/en-gb/linkedin/shared/authentication/programmatic-refresh-tokens?context=linkedin%2Fcontext

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading