Copy link to clipboard
Copied
Hello,
Is there a way to get a refresh token for the Document Services API? Currently, access tokens expire every 24 hours, so need to generate a new one every day.
(Basically the same as a this question from 2 years ago, but that got no replies so thought I'd make a new post!)
Thank you!
Copy link to clipboard
Copied
I'm not sure I get you - your code can simply request a new access token, right?
Copy link to clipboard
Copied
Yes, that's what I currently have to do, but, given that refresh tokens are common for other APIs (including some Adobe ones), wondering if they exist for the Document Services API.
i.e. It seems refresh tokens are generally best (and standard) practice for longer-term use e.g. Adobe Sign API has refresh tokens that are valid for 60 days, and which automatically refresh once used, meaning my code doesn't have to keep generating and storing new access tokens to use the API every single day.
Other big company APIs (e.g. Quickbooks, Calendly, Microsoft) also offer refresh tokens, so just wondering if I can use them with the Document Services API, or if there's some other recommendation instead? Hopefully that's clear!
Copy link to clipboard
Copied
Sorry, I mean Document Generation* API, not Document Services!
Copy link to clipboard
Copied
Eh, I typically just got a new token each call. It's one quick network call so it doesn't seem "wasteful". To be clear, I don't mean one 'call' but one script. So if I were writing code to: Upload a Word doc. Convert to PDF. Optimize the PDF. Split it. That operation would get a token once and use it for all the calls.
If I had long running code, I'd get the token plus expiration and only fetch the token again when it expires.
Copy link to clipboard
Copied
I have a server app that's constantly running. I only refresh the access token every 20 hours though. The code looks like this...
async function refreshAccessToken() {
accessToken = await getAccessToken(CLIENT_ID, CLIENT_SECRET);
console.log(":rocket: : accessToken Refreshed");
return accessToken;
}
let accessToken = refreshAccessToken();
setTimeout(refreshAccessToken, TWENTY_HOURS);
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more