Search code examples
docusignapidocusigncompositetmplts

Docusign API's failing after an hour


I have a docusign-sandbox account. I am trying to integrate docusign with my application and am using JWT Grant for authentication in java. I got a sample code from https://github.com/docusign/eg-01-java-jwt and it works perfectly for an hour and then the API starts failing.

Any idea how I can tackle this issue?

I'm getting the below error

I already tried changing the Token expiry time from 1hr to other lesser values(5 min, 30 min). Even then the APIs start failing exactly after an hour.

https://github.com/docusign/eg-01-java-jwt

ERROR MESSAGE

{"timestamp":1560750467288,"status":500,"error":"Internal Server Error","message":"Error while requesting server, received a non successful HTTP code 401 with response Body: '{\r\n  \"errorCode\": \"USER_AUTHENTICATION_FAILED\",\r\n  \"message\": \"One or both of Username and Password are invalid. Invalid access token\"\r\n}'","path":"{path}"}

Solution

  • Found a way around the problem.

    The access token was being generated but for some reason it was not updating the token in the ApiClient Object and was using the old token only. So now I am just creating a new ApiClient Object every time the token expires instead of replacing the old token with the new one.