Jeet
Jeet

Reputation: 51

How can i get docusign access token in nodejs to sign the document

I want to use DocuSign embedded signing to sign a document.

How can I get a access token to sign a document?

I manually get the access token, which is valid for 8 hour, but I want to generate access token in Node.js API. How can I get it?

I have tried the following:

Upvotes: 1

Views: 2205

Answers (2)

Jeet
Jeet

Reputation: 51

finally i got my answer from this article

This article explains how to obtain and use an Access Token from a Refresh Token in the Authorization Code Grant Flow for the Docusign REST API

user login once and then have the application use the Refresh Token returned on the first successful authentication attempt to obtain a new Access Token so that the user would not need to login again and again. You can use docusign-auth-code-grant.

Upvotes: 1

Amit K Bist
Amit K Bist

Reputation: 6818

If you are using User Application then you need to check Authorization Code Grant to learn how DocuSign using this type of Grant to generate AccessToken and RefreshToken.

In User Application flow, AccessToken is provided for 8 hours and once AccessToken expires then your App needs to use Refresh Token to generate new set of Access and Refresh Token.

But if you are using System Integration then you need to check JSON Web Token Grant to learn how DocuSign provides AccessToken using JWT.

In System Integration flow, it is assumed that an API user in your App behind the scene will call DS API, and there is no DocuSign User interaction to login after certain interval to provide access to your App to generate Access token on behalf of the logged in user once Refresh token expires. System Integration Flow will get one time consent, Obtaining Consent explains how to get Consent. Once consent in provided to the Integrator Key then Integrator Key via your app can generate AccessToken any time, and this AccessToken will be valid for 3600 seconds, once it expires then you create new JWT and call DocuSign OAUTH API to generate new AccessToken for next 3600 seconds.

Node JS_03 is an example showing how User Application flow works.

Node JS_01, check for dsJwtAuth.js is an example showing how System Integration flow works using JWT.

Upvotes: 2

Related Questions