Refresh token error "response_type or grant_type is required"

I am trying to refresh a token but keep getting “response_type or grant_type is required” error message and status code 400.

In docs there is no mention of response_type parameter so not sure what to enter and I do have grant_type:refresh_token defined as parameter.

My post url is :

https://api.infusionsoft.com/token?grant_type=refresh_token&refresh_token=mysecret-refresh-token

and my headers are defined as

Content-Type:application/x-www-form-urlencoded
Authorization:Basic A2o41234MzRoXmF1bmZ4a3FmdXgzb1234560V2g3NVFt123=
Host:api.infusionsoft.com

In both postman and my code I get error

{
“error”: “invalid_request”,
“error_description”: “response_type or grant_type is required”
}

IS, you really need to sort your documentation out as it is either incorrect or out of date but same effect - the info is wrong

Changing from parameters to supply values rather as body to post works.

And, yes ‘params’ can be used in different contexts…

Docs say there are three ways to do it.

FYI most here do not work for IS including me :wink:

Understood and assumed. Just hoping someone from IS will look and take note.

I don’t see three ways to refresh tokens BTW.

For those interested here is NodeJS code using axis to refresh token. Note that the required grant_type and refresh_token parameters are to be sent via body and not as query parameters in url.

function refreshAccessToken(token) {
  let url = 'https://api.infusionsoft.com/token'
  let authData = clientId + ':' + clientSecret

  /* global Buffer */
  let buff = Buffer.from(authData)

  let headers = {
    'Authorization': 'Basic ' + buff.toString('base64'),
    'Content-Type': 'application/x-www-form-urlencoded'    
  }
  
  const data = new URLSearchParams();
  data.append('grant_type', 'refresh_token');
  data.append('refresh_token', token);
  
  post(url, data, {headers: headers})
    .then((res) => {
      console.log('got token', res.data)
    })
    .catch((err) => {
      console.log('AXIOS Error: ', err)
    })
}