Reputation: 318
I am following the same code as in Examplebase class to get the JWT token and it suppose to renew the token after the token expired, but instead I am getting the following error after sometime.
below is the github link
com.docusign.esign.client.ApiException: Error while requesting server, received a non successful HTTP code 401 with response Body: '{
"errorCode": "USER_AUTHENTICATION_FAILED",
"message": "One or both of Username and Password are invalid. Invalid access token"
}'
at com.docusign.esign.client.ApiClient.invokeAPI(ApiClient.java:1053)
at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:701)
at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:651)
Upvotes: 0
Views: 3601
Reputation: 318
Solved the Error using the answer given in the following question, please check there Docusign API's failing after an hour
Upvotes: 0
Reputation: 49114
Are you calling check_token before each call to the DocuSign API? The check_token method checks the token expiration and then should generate a new one if the old one is about to expire.
Since JWT tokens only last an hour, it is not too hard to create a token then debug 55 minutes later. With a 10 minute buffer time, line 37 in the code should be triggered to create a new token at that time.
Upvotes: 1
Reputation: 14050
Not sure what you mean by "it suppose to renew the token after the token expired" this you need to write code for. It's not happening automatically. If you use the same token you originally obtained (and it worked before) after 8 hours it will no longer work. I am assuming that's what is happening here. You need to use the refresh token to obtain a new token at that point.
Upvotes: 0