Skip to main content
Participant
March 19, 2024
Question

Refresh Token for Document Services API?

  • March 19, 2024
  • 2 replies
  • 896 views

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!

    This topic has been closed for replies.

    2 replies

    Joel Geraci
    Community Expert
    Community Expert
    March 19, 2024

    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("🚀 : accessToken Refreshed");
    	return accessToken;
    }
    let accessToken = refreshAccessToken();
    setTimeout(refreshAccessToken, TWENTY_HOURS);
    Raymond Camden
    Community Manager
    Community Manager
    March 19, 2024

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

    Participant
    March 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!

    Participant
    March 19, 2024

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