Skip to main content

I want to integrate Docusign with spring boot . i am using java 17 and spring boot 2.4.2 version and Docusign 3.18.0 . when i am creating a object of ApiClient and want to access token from apiClient.requestJWTUserToken . i am getting error and not able get the token . please help me if posiible.thanks in advance.

Hi rahulmishra179,

Welcome to the DocuSign Community!

In order to assist you in a better way, it would be ideal for you to share the error you are having.

However, I share the documentation on how to use JWT in Java and how to obtain the access token in the following link

https://developers.docusign.com/docs/esign-rest-api/sdks/java/auth/#:~:text=Using%20Authorization%20Code%20Grant%20with%20Spring%20Boot%20web%20applications

 

  ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
apiClient.setOAuthBasePath("account-d.docusign.com");
ArrayList<String> scopes = new ArrayList<String>();
scopes.add("signature");
scopes.add("impersonation");
bytee] privateKeyBytes = Files.readAllBytes(Paths.get(prop.getProperty("rsaKeyFile")));
OAuthToken oAuthToken = apiClient.requestJWTUserToken(
prop.getProperty("clientId"),
prop.getProperty("userId"),
scopes,
privateKeyBytes,
3600);
String accessToken = oAuthToken.getAccessToken();

The above is an example of the code that is used in our SDK to obtain said access token, in this link you can obtain more information

https://github.com/docusign/code-examples-java/blob/master/JWT%20Console%20App/src/main/java/com/docusign/JWTConsoleApp.java

 

Regards,

 

Eric | Docusign


Reply