Can some has the same issue im having,
I triedto run the code below from my serverless function. And it has url generated url but the problem is my expire value didn’t work. I set the expire time to 60 secs but I keep visiting the url more than 2 or 5 mins it still viewable. Is hubspot default 24hrs ?
Let me know please!
const axios = require('axios');
exports.main = async (context, sendResponse) => {
const fileId = "1234567890";
// const fileId = context.module.file_id;
// const expiresAt = Date.now() + 15 * 60 * 1000;
const expiresAt = Date.now() + 60 * 1000;
const expirationSeconds = 60;
var config = {
method: 'get',
maxBodyLength: Infinity,
url: `https://api.hubapi.com/filemanager/api/v3/files/${fileId}/signed-url?expiresAt=${expirationSeconds}`,
headers: {
Authorization: "Bearer sample-tokenhere"
}
};
axios(config)
.then((response) => {
const data = JSON.stringify(response.data);
sendResponse({ body: data, statusCode: 200 });
document.getElementById('file-link').textContent = response.data.url;
})
.catch(function (error) {
console.log(error);
sendResponse({ body: error, statusCode: 400 });
});
return;
};