Problems with OAuth2 refresh token request

  • 1 March 2022
  • 2 replies

Userlevel 3


I am creating a new integration using OAuth2 for a connection to our application. Initial login is working but I am having an issue with the refresh token request.

I am using the web site to enter in code view Refresh Token Request.

The code I have at the moment:

const options = {
  url: 'https://my.domain/system/oauth2/refresh',
  method: 'POST',
  headers: {
    'Host': 'my.domain',
    'content-type': 'application/x-www-form-urlencoded',
    'accept': 'application/json'
  body: {
    'code': bundle.inputData.code,
    'client_id': process.env.CLIENT_ID,
    'client_secret': process.env.CLIENT_SECRET,
    'grant_type': 'refresh_token',
    'redirect_uri': bundle.inputData.redirect_uri,
    'refresh_token': bundle.authData.REFRESH_TOKEN,
    'params': '{ params: "test"}'


Since I can log and so view what is arriving at the host I can see that the result is that important fields are empty in the message arriving in the application:


attributes {

    ""params"":""{ params: ""test\""}"",


I have replaced the secret things with ********** in the log.

The values in refresh_token is blank!



This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +12

are you sure refresh token is stored in {{bundle.authData.REFRESH_TOKEN}} and not {{bundle.authData.refresh_token}} ?

in Zapier you can z.console.log(bundle.authData) (or try just returning bundle.authData) to get a better idea of the variables stored. 

Userlevel 3

Thanks I used your suggestion to dump out the bundle.authData and you are correct. Unfortunately although I changed my code it still returns an empty string.

Any ideas?