Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Refresh Token for Document Services API?

New Here ,
Mar 19, 2024 Mar 19, 2024

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!

959
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 19, 2024 Mar 19, 2024

I'm not sure I get you - your code can simply request a new access token, right? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2024 Mar 19, 2024

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2024 Mar 19, 2024

Sorry, I mean Document Generation* API, not Document Services!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 19, 2024 Mar 19, 2024

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2024 Mar 19, 2024
LATEST

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);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources