I’m trying to build a private Zapier app using the Service Fusion API documentation. I’m having trouble with Authentication. I can get it to authenticate, but it always expires.
I’ve tried using the refresh token in Form mode and in Code mode as well, but it doesn’t ever seem to work inside of the Zapier app. It’ll be fine the first use, but then the auth expires.
Here’s the Access Token Request code we’re using:
const options = {
url: 'https://api.servicefusion.com/oauth/access_token',
method: 'POST',
headers: {
'content-type': 'application/json'
},
params: {
},
body: {
'grant_type': 'authorization_code',
'client_id': process.env.CLIENT_ID,
'client_secret': process.env.CLIENT_SECRET,
'code': bundle.inputData.code,
'redirect_uri': bundle.inputData.redirect_uri
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
return results;
});
Here’s the Refresh Token Request code we’re using:
const options = {
url: 'https://api.servicefusion.com/oauth/access_token',
method: 'POST',
headers: {
'content-type': 'application/json'
},
params: {
},
body: {
'grant_type': 'refresh_token',
'refresh_token': bundle.authData.refresh_token
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
z.console.log(bundle.authData)
return results;
});
Does anyone with Service Fusion experience have any advice?