Linkedin API : No refresh token with accessToken

240 views Asked by At

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 ?

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'
}
1

There are 1 answers

0
amac On BEST ANSWER

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