Created
February 19, 2018 21:46
-
-
Save DSDevCenter/09aba496fa611cff2d0fdc7f5bd79423 to your computer and use it in GitHub Desktop.
DocuSign NODE SDK Example - Get Base URI (note currently using a legacy endpoint, update coming soon)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creating an instance of the authentication API | |
var authApi = new docusign.AuthenticationApi(apiClient); | |
var loginOps = {}; | |
loginOps.apiPassword = 'true'; | |
loginOps.includeAccountIdGuid = 'true'; | |
// making login call. we could also use DocuSign OAuth userinfo call | |
authApi.login(loginOps, function (error, loginInfo, response) { | |
if (error) { | |
return res.send(error); | |
} | |
if (loginInfo) { | |
// list of user account(s) | |
// note that a given user may be a member of multiple accounts | |
var loginAccounts = loginInfo.loginAccounts; | |
var loginAccount = loginAccounts[0]; | |
var baseUri = loginAccount.baseUrl; | |
var accountDomain = baseUri.split('/v2'); | |
// below code required for production, no effect in demo (same domain) | |
apiClient.setBasePath(accountDomain[0]); | |
docusign.Configuration.default.setDefaultApiClient(apiClient); | |
// return the list of accounts to the browser | |
console.log("LoginAccounts = ", loginAccounts); | |
return res.send(loginAccounts); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment