I am following this code sample and kept running into many errors.
One of the error was that it could not find body so realized to use
const result = await accountApi.createClickwrap(accountId, clickwrapRequest);
instead of the following as given in code base
const result = await accountApi.createClickwrap(accountId, { clickwrapRequest });
But now I am stuck at 401 error, unable to understand the error at all.
{
statusCode: 401,
header: Object [AxiosHeaders] {
'cache-control': 'no-cache',
'x-docusign-tracetoken': '86….,
'x-docusign-node': 'DA...',
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
date: 'Thu, 23 Jan 2025 19:04:23 GMT',
'content-length': '0',
'set-cookie': [
'BIGipServerpool_Demo_API_Click=!SQ…..=; path=/; Httponly; Secure'
]
},
body: ''
}
I am adding fresh access token:
//DOCUSIGN_CLICK_API_BASE_PATH="https://demo.docusign.net/clickapi"
const docusignClick = require("docusign-click");
...
this.dsApiClient = new docusignClick.ApiClient();
...
this.dsApiClient.setBasePath(process.env.DOCUSIGN_CLICK_API_BASE_PATH);
console.log('Access token: ', req.session.access_token)
this.dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + req.session.access_token);
What am I doing wrong? Do let me know if you need more information.