Skip to content

Commit f62f137

Browse files
author
nianiB9
committed
2 parents 81e473b + 765af33 commit f62f137

37 files changed

+1985
-342
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
>
77
### GitHub repo: [code-examples-node](./README.md)
88

9+
If you downloaded this project using the [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) tool, it may be configured in one of three ways:
10+
11+
* **[JWT Grant remote signing example](#jwt-grant-remote-signing-example)**–demonstrates how to implement JSON Web Token authentication. It includes a single remote signing workflow.
12+
* **[Authorization Code Grant embedded signing example](#authorization-code-grant-embedded-signing-example)**–demonstrates how to implement Authorization Code Grant authentication. It includes a single embedded signing workflow.
13+
* **[Multiple code examples, Authorization Code Grant and JWT Grant](#installation-steps)**–includes the full range of examples and authentication types.
14+
15+
***Installation and running instructions vary depending on the configuration. Follow the link that matches your project type to get started.***
16+
917
This GitHub repo includes code examples for the [Web Forms API](https://developers.docusign.com/docs/web-forms-api/), [Click API](https://developers.docusign.com/docs/click-api/), [eSignature REST API](https://developers.docusign.com/docs/esign-rest-api/), [Monitor API](https://developers.docusign.com/docs/monitor-api/), and [Rooms API](https://developers.docusign.com/docs/rooms-api/).
1018

1119
## Introduction
@@ -133,6 +141,24 @@ Also, in order to select JSON Web Token authentication in the launcher, in confi
133141
## JWT grant remote signing and Authorization Code Grant embedded signing projects
134142
See [Docusign Quickstart overview](https://developers.docusign.com/docs/esign-rest-api/quickstart/overview/) on the Docusign Developer Center for more information on how to run the JWT grant remote signing project and the Authorization Code Grant embedded signing project.
135143

144+
### Authorization Code Grant embedded signing example:
145+
Run in Git Bash:
146+
```
147+
$ cd <Quickstart folder>/quick_acg
148+
$ npm install
149+
$ npm start
150+
```
151+
152+
Open a browser to http://localhost:3000
153+
154+
### JWT grant remote signing example:
155+
Run in Windows Command Prompt (CMD):
156+
```
157+
$ cd <Quickstart folder>/jwt_console_project
158+
$ npm install
159+
$ npm start
160+
```
161+
136162
## Payments code example
137163

138164
To use the payments code example, create a test payment gateway on the [Payments](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details.

config/appsettings.example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
"adminAPIUrl": "https://api-d.docusign.net/management",
3131
"monitorApiUrl": "https://lens-d.docusign.net",
3232
"webformsApiUrl": "https://apps-d.docusign.com/api/webforms/v1.1",
33+
"iamBasePath": "https://api-d.docusign.com/v1",
3334
"codeExamplesManifest": "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/CodeExamplesManifest.json"
3435
}

index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const { eg001connect } = require('./lib/connect/controllers');
5959
const { eg001webforms } = require('./lib/webforms/controllers');
6060
const { eg004notary } = require('./lib/notary/controllers');
6161
const { eg001fields } = require('./lib/connectedFields/controllers');
62+
const { eg001Navigator, eg002Navigator } = require('./lib/navigator/controllers');
63+
const { eg001maestro, eg002maestro, eg003maestro, eg004maestro } = require('./lib/maestro/controllers');
6264

6365
const PORT = process.env.PORT || 3000;
6466
const HOST = process.env.HOST || 'localhost';
@@ -293,6 +295,20 @@ app.get('/neg004', eg004notary.getController)
293295
app.get('/feg001', eg001fields.getController)
294296
.post('/feg001', eg001fields.createController);
295297

298+
app.get('/nav001', eg001Navigator.getController)
299+
.post('/nav001', eg001Navigator.createController)
300+
.get('/nav002', eg002Navigator.getController)
301+
.post('/nav002', eg002Navigator.createController);
302+
303+
app.get('/mae001', eg001maestro.getController)
304+
.post('/mae001', eg001maestro.createController)
305+
.post('/mae001publish', eg001maestro.publishController)
306+
.get('/mae002', eg002maestro.getController)
307+
.post('/mae002', eg002maestro.createController)
308+
.get('/mae003', eg003maestro.getController)
309+
.post('/mae003', eg003maestro.createController)
310+
.get('/mae004', eg004maestro.getController)
311+
.post('/mae004', eg004maestro.createController);
296312

297313
function dsLoginCB1(req, res, next) { req.dsAuthCodeGrant.oauth_callback1(req, res, next); }
298314
function dsLoginCB2(req, res, next) { req.dsAuthCodeGrant.oauth_callback2(req, res, next); }
@@ -347,6 +363,9 @@ const NOTARY_SCOPES = [
347363
const CONNECTED_FIELDS_SCOPES = [
348364
'signature', 'adm_store_unified_repo_read'
349365
];
366+
const MAESTRO_SCOPES = [
367+
'signature', 'aow_manage'
368+
];
350369

351370
const scope = [
352371
...ROOM_SCOPES,
@@ -357,6 +376,7 @@ const scope = [
357376
...WEBFORMS_SCOPES,
358377
...NOTARY_SCOPES,
359378
...CONNECTED_FIELDS_SCOPES,
379+
...MAESTRO_SCOPES
360380
];
361381

362382
// Configure passport for DocusignStrategy

lib/connectedFields/controllers/eg001SetConnectedFields.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
const path = require('path');
8-
const { getTabGroups, sendEnvelope, extractVerificationData } = require('../examples/setConnectedFields');
8+
const { getTabGroups, sendEnvelope, filterData } = require('../examples/setConnectedFields');
99
const validator = require('validator');
1010
const { getExampleByNumber } = require('../../manifestService');
1111
const dsConfig = require('../../../config/index.js').config;
@@ -40,12 +40,13 @@ eg001SetConnectedFields.createController = async (req, res) => {
4040
// Step 2. Call the worker method
4141
const { body } = req;
4242
const selectedAppId = validator.escape(body.appId);
43-
const verificationData = extractVerificationData(selectedAppId, req.session.apps);
43+
const selectedApp = req.session.apps.find(app => app.appId === selectedAppId);
4444
const envelopeArgs = {
4545
signerEmail: validator.escape(body.signerEmail),
4646
signerName: validator.escape(body.signerName),
4747
docFile: path.resolve(demoDocsPath, pdfFile),
48-
verificationData
48+
appId: selectedAppId,
49+
app: selectedApp,
4950
};
5051
const args = {
5152
accessToken: req.user.accessToken,
@@ -93,19 +94,18 @@ eg001SetConnectedFields.createController = async (req, res) => {
9394

9495
const args = {
9596
accessToken: req.user.accessToken,
96-
basePath: 'https://api-d.docusign.com',
97+
basePath: dsConfig.iamBasePath,
9798
accountId: req.session.accountId,
9899
};
99-
const tabGroups = await getTabGroups(args);
100+
let tabGroups = await getTabGroups(args);
101+
tabGroups = filterData(tabGroups);
100102

101103
const example = getExampleByNumber(res.locals.manifest, exampleNumber, api);
102104
if (tabGroups.length === 0) {
103-
const additionalPageData = example.AdditionalPage.filter(p => p.Name === 'no_verification_app')[0];
104-
105-
return res.render('pages/example_done', {
106-
title: example.ExampleName,
107-
message: additionalPageData?.ResultsPageText,
108-
});
105+
const errorCode = '404';
106+
const errorMessage = 'No data verification extension apps found';
107+
const errorInfo = example.CustomErrorTexts[0].ErrorMessage;
108+
return res.render('pages/error', { errorCode, errorMessage, errorInfo });
109109
}
110110
req.session.apps = tabGroups;
111111

0 commit comments

Comments
 (0)