Docusign API's failing after an hour

走远了吗. 提交于 2020-04-16 09:16:30

问题


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}"}

回答1:


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.




回答2:


The jwt grant returns an access token that is only valid for 1 hour. After that, you need to generate a new token for another hour.

Call the example's checkToken method before each API call. It should create a new access token as needed.

Added

You'll need to debug to see what's happening. Is the checkToken method obtaining a new access token after 50 minutes (it should be using a 10 minute buffer time). Is the new access token being used?



来源:https://stackoverflow.com/questions/56625792/docusign-apis-failing-after-an-hour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!