Closed Atrus619 closed 4 years ago
Hey @Atrus619
Regarding your issues: I would need more info on Upon using the access token generated automatically, I get an error of "Unauthorized" to get info on whats going wrong with this. I am unsure of the steps you chose during this authorization path.
However, it looks like you're almost there with your JWT auth. You just need to get consent. Can I direct you to our JWT guides? They will walk you through this process. https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken Step 1: Request Application Consent
Please feel free to comment here if that doesn't work for you.
@acooper4960 Thank you for the prompt reply! I apologize for the vagueness in the issue. I will be sure to clarify below:
Hi @Atrus619 let me see if Ive got it straight here. You would like behavior similar to our automated tests. We run them all the time and they authenticate without human intervention and create envelopes amongst other things. The preferred authentication method for this type of use case is the JWT grant flow.
In order to grant consent, the user your JWT auth is impersonating must perform the manual step illustrated in Step 1: Request Application Consent by manually going to that url themself. Its a one time deal and then you should be ready to send as many envelopes as you like.
On the last question, the auth api is the authentication api we use for the entire platform, this is a reason we use oauth in the first place. The token it generates is valid for esign rest.
If you would like a reference, please feel free to check out how tests/SDKUnitTests.js uses JWT auth.
Does that help?
@acooper4960 This makes sense, thanks for pointing me to that file. Before I dive into testing this out, I just wanted to get clarification on a few things:
sure thing @Atrus619 yes theres an expiration, and no consent is a one time deal. Our automated tests surely wouldn't work if we needed to keep getting consent
Closing due to lack of recent comments. Please comment if there are still questions on this issue. Thank you.
I've been successful in generating access tokens using dsApiClient.requestJwtApplicationToken. However, the first issue that comes up is that in the response, the token_type is "Application", even though the documentation specifies that it should be "Bearer" (see: https://developers.docusign.com/orgadmin-api/guides/auth/application-auth)
Upon trying to use this access token, I instantiate a new docusign api client and add the access token to the header as follows:
Note that this strategy works perfectly well if I use the oauth token generator (using: https://developers.docusign.com/oauth-token-generator)
Upon using the access token generated automatically, I get an error of "Unauthorized" If I change the header to say "Application" instead of "Bearer", I get an error of "Invalid Request" (so I am assuming that is incorrect syntax).
If I instead use the requestJwtUserToken method along with a User API ID, then I get an error (upon requesting the access token) of "no consent granted".
How am I supposed to generate an access token programmatically for my backend server?