Getting: 'exp' claim. Should be an integer [400 Bad Request] invalid_grant
When running our program we get this error occasionally. I had referenced this post: Getting Please check the 'exp' claim Exception – Box Support but when we checked our machines time it was in sync. Is there any other reason why we may be getting this error. Thanks!
-
Hi Alex,
Yes, we are still having this issue... It happens pretty inconsistently, we had our machine team look into it on their end to see if our machines were causing the time difference but they told us that our machines would match the current Unix time so it is unlikely that it is on our end... When we use the box API we are uploading quite a large number of files. Any advice on a fix would be great. Thank you!
-
Yes we have three separate instances, the one I linked was for our dev account, I can get you the production enterprise id if you need.
Here is a code snippet of our file upload process:
function readFiles(folderId, client, queryData, countryCode, retryFlag) {
return new Promise((resolve, reject) => {
try {
var dir = normalPath.normalize(path.join(__dirname, "/../fileStorage"));
var allowIZ = /(\.i6z)$/i;
fs.readdir(dir, (err, file) => {
file.forEach(async function (filePath) {
try {
console.log(filePath);
if (allowIZ.exec(filePath)) {
var stream = fs.createReadStream(normalPath.normalize(path.join(dir, "/" + filePath)));
let file = await client.files.uploadFile(folderId, filePath, stream)
let updatedFile = await client.files.update(file.entries[0].id, { shared_link: {} })
let url = updatedFile.shared_link.download_url;
resolve(uploadID(updatedFile.id, filePath, queryData.id, url, countryCode));
}//if
} catch (e) {
if (!retryFlag) {
let retryResponse = await this.readFiles(folderId, client, queryData, countryCode, true);
resolve(retryResponse);
} else {
if (e.statusCode == 500) {
resolve('500')
} else if (e.statusCode == 400 || e.statusCode == 409) {
resolve('400')
} else if (e instanceof ReferenceError) {
resolve('refError');
} else if (e instanceof TypeError) {
resolve('typeError');
}
}
reject(e)
}
});//forEach
});//readDir
} catch (e) {
if (e.statusCode == 500) {
resolve(0)
} else if (e.statusCode == 400) {
resolve(1)
}
reject(e)
}
});
}
投稿コメントは受け付けていません。
コメント
8件のコメント