docusign / docusign-esign-java-client

The Official Docusign Java Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://javadoc.io/doc/com.docusign/docusign-esign-java/latest/index.html
MIT License
105 stars 96 forks source link

"errorCode": PARTNER_AUTHENTICATION_FAILED #232

Closed dharanesh003 closed 2 years ago

dharanesh003 commented 2 years ago

Hello,

I get the same error when I try to make a call to get the access token

Error: { "errorCode": "PARTNER_AUTHENTICATION_FAILED", "message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified." } Below is the method I call to get the access token public String getAccessToken(){ List scopes = new ArrayList(); scopes.add("signature"); scopes.add("impersonation"); //the Key from the privateKey.txt needs to be replaced with the appropriate demo account, currently it has production key File privateKeyFile = new File("privateKey.txt"); FileInputStream fin; byte privateKeyFileContent[] = null; OAuth.OAuthToken oAuthToken; try { // create FileInputStream object fin = new FileInputStream(privateKeyFile); privateKeyFileContent = new byte[(int)privateKeyFile.length()];

// Reads up to certain bytes of data from this input stream into an array of bytes.
fin.read(privateKeyFileContent);

} catch (IOException e) { e.printStackTrace(); }

ApiClient apiClient = new ApiClient();

//the below URL needs to be changed to account.docusign.com for production authentication apiClient.setOAuthBasePath("account-d.docusign.com"); try { oAuthToken = apiClient.requestJWTUserToken( dcsIntegratorKey, dcsUserName, scopes, privateKeyFileContent, TOKEN_EXPIRATION_IN_SECONDS); accessToken = oAuthToken.getAccessToken();

} catch (ApiException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return accessToken; } dcsIntegratorKey = Integration key dcsUserName = User Id value for the user I am impersonating.

Any thoughts on what could be the issue or how to debug this?

Thanks

dharanesh003 commented 2 years ago

Adding more details:

I see from the logs that Access token is being generated, however I still get the PARTNER_AUTHENTICATION_FAILED error code. Can you please let me know what needs to be passed in the header? Currently I am passing ("Bearer", accesstoken).

Thanks

Jsammons90 commented 2 years ago

Hi Dharanesh003,

This error has a few different reasons that it might appear as outlined here: https://www.docusign.com/blog/dsdev-from-the-trenches-may-2020

We've opened case 09452018 in regards to this issue - if you can provide an email address, we can correspond through there to gather more information.

Best regards, Jonathan | DocuSign Developer Support

dharanesh003 commented 2 years ago

Hey Jonathan,

Thanks of the response. I was able to resolve this issue. I had to change the header value to have it working correctly. Ex: Header("Authorization", "Bearer " + "access token");

Previously my header was just Header("Bearer " + "access token");

Thanks