You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constresponseType=apiClient.OAuth.ResponseType.TOKEN; // Response type of token, to be used for implicit grant
121
-
constscopes= [apiClient.OAuth.Scope.EXTENDED];
122
-
constrandomState="*^.$DGj*)+}Jk"; // after successful login you should compare the value of URI decoded "state" query param with the one created here. They should match
const responseType = apiClient.OAuth.ResponseType.TOKEN; // Response type of token, to be used for implicit grant
227
+
const scopes = [apiClient.OAuth.Scope.EXTENDED];
228
+
const randomState = "*^.$DGj*)+}Jk"; // after successful login you should compare the value of URI decoded "state" query param with the one created here. They should match
332
229
333
-
functionsendTemplate (loginAccount, next) {
334
-
// create a new envelope object that we will manage the signature request through
335
-
var envDef =newdocusign.EnvelopeDefinition();
336
-
envDef.setEmailSubject('Please sign this document sent from Node SDK');
337
-
envDef.setTemplateId(templateId);
230
+
apiClient.setBasePath(basePath);
338
231
339
-
// create a template role with a valid templateId and roleName and assign signer info
The `getUserInfo` method can be used to call the OAuth::userInfo endpoint. See the file
288
+
[ApiClient.js](https://github.com/docusign/docusign-node-client/blob/master/src/ApiClient.js), line 713.
396
289
397
-
## Service Integrations that use Legacy Header Authentication
290
+
Use the results to choose the account. One of the user's accounts is their default account.
291
+
The method's results include the selected account's `base_uri` field.
398
292
399
-
([Legacy Header Authentication](https://docs.docusign.com/esign/guide/authentication/legacy_auth.html) uses the X-DocuSign-Authentication header.)
293
+
Note: The host for the OAuth::userInfo method is `account-d.docusign.com` for the demo/developer environment,
294
+
and `account.docusign.com` for the production environments.
295
+
1. Combine the base_uri with "/restapi" to create the basePath.
296
+
Use the basePath for your subsequent API calls for the account id.
400
297
401
-
1. Use the [Authentication: login method](https://docs.docusign.com/esign/restapi/Authentication/Authentication/login/) to retrieve the account number **and the baseUrl** for the account.
402
-
The url for the login method is www.docusign.net for production and demo.docusign.net for the developer sandbox.
403
-
The `baseUrl` field is part of the `loginAccount` object. See the [docs and the loginAccount object](https://docs.docusign.com/esign/restapi/Authentication/Authentication/login/#/definitions/loginAccount)
404
-
2. The baseUrl for the selected account, in production, will start with na1, na2, na3, eu1, or something else. Use the baseUrl that is returned to create the *basePath* (see the next step.) Use the basePath for all of your subsequent API calls.
405
-
3. As returned by login method, the baseUrl includes the API version and account id. Split the string to obtain the *basePath*, just the server name and api name. Eg, you will receive `https://na1.docusign.net/restapi/v2/accounts/123123123`. You want just `https://na1.docusign.net/restapi`
406
-
4. Instantiate the SDK using the basePath. Eg `ApiClient apiClient = new ApiClient(basePath);`
407
-
5. Set the authentication header as shown in the examples by using `Configuration.Default.AddDefaultHeader`
408
-
409
-
## User Applications that use OAuth Authentication
410
-
1. After obtaining a Bearer token, call the [OAuth: Userinfo method](https://docs.docusign.com/esign/guide/authentication/userinfo.html). Obtain the selected account's `base_uri` (server name) field.
411
-
The url for the Userinfo method is account-d.docusign.com for the demo/developer environment, and account.docusign.com for the production environment.
412
-
1. Combine the base_uri with "/restapi" to create the basePath. The base_uri will start with na1, na2, na3, eu1, or something else. Use the basePath for your subsequent API calls.
413
-
4. Instantiate the SDK using the basePath. Eg `ApiClient apiClient = new ApiClient(basePath);`
414
-
5. Create the `authentication_value` by combining the `token_type` and `access_token` fields you receive from either an [Authorization Code Grant](https://docs.docusign.com/esign/guide/authentication/oa2_auth_code.html) or [Implicit Grant](https://docs.docusign.com/esign/guide/authentication/oa2_implicit.html) OAuth flow.
415
-
5. Set the authentication header by using `Configuration.Default.AddDefaultHeader('Authorization', authentication_value)`
298
+
You can and should cache the basePath for at least the user's session with your application. It changes very infrequently.
299
+
1. Instantiate the SDK using the basePath. Eg `ApiClient apiClient = new ApiClient(basePath);`
300
+
1. Create the `authentication_value` by combining the `token_type` and `access_token` fields you
301
+
receive from a DocuSign OAuth flow.
302
+
See the [authentication guide.](https://developers.docusign.com/esign-rest-api/guides/authentication)
303
+
1. Set the SDK's authentication header by using `Configuration.Default.AddDefaultHeader('Authorization', authentication_value)`
416
304
417
305
Testing
418
306
=======
@@ -432,8 +320,7 @@ Feel free to log issues against this client through GitHub. We also have an act
432
320
License
433
321
=======
434
322
435
-
The DocuSign Node Client is licensed under the following [License](LICENSE).
436
-
323
+
The DocuSign Node Client is licensed under the MIT [License](LICENSE).
0 commit comments