@@ -56,11 +56,10 @@ eg001EmbeddedSigning.createController = async (req, res) => {
5656 dsReturnUrl : dsReturnUrl ,
5757 dsPingUrl : dsPingUrl
5858 }
59- , accountId = req . dsAuthCodeGrant . getAccountId ( )
60- , dsAPIclient = req . dsAuthCodeGrant . getDSApi ( )
6159 , args = {
62- dsAPIclient : dsAPIclient ,
63- accountId : accountId ,
60+ accessToken : req . user . accessToken ,
61+ basePath : req . session . basePath ,
62+ accountId : req . session . accountId ,
6463 envelopeArgs : envelopeArgs
6564 }
6665 , results = null
@@ -92,17 +91,15 @@ eg001EmbeddedSigning.createController = async (req, res) => {
9291/**
9392 * This function does the work of creating the envelope and the
9493 * embedded Signing Ceremony
95- * @param {object } args An object with the following elements: <br/>
96- * <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
97- * <tt>accountId</tt>: Current account Id <br/>
98- * <tt>envelopeArgs</tt>: envelopeArgs, an object with elements
99- * <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>signerClientId</tt>
94+ * @param {object } args
10095 */
10196// ***DS.worker.start ***DS.snippet.1.start
10297eg001EmbeddedSigning . worker = async ( args ) => {
103- let envelopesApi = new docusign . EnvelopesApi ( args . dsAPIclient )
104- , results = null
105- ;
98+ let dsApiClient = new docusign . ApiClient ( ) ;
99+ dsApiClient . setBasePath ( args . basePath ) ;
100+ dsApiClient . addDefaultHeader ( 'Authorization' , 'Bearer ' + args . accessToken ) ;
101+ let envelopesApi = new docusign . EnvelopesApi ( dsApiClient )
102+ , results = null ;
106103
107104 // Step 1. Make the envelope request body
108105 let envelope = makeEnvelope ( args . envelopeArgs )
0 commit comments