Got error while requesting accessToken


  • Hello Devs!
    I am using nodejs SDK to connect with angel one smart API. I did code by reading your document but I am getting the below error while requesting accessToken.

    ERROR:
    TypeError: Cannot read properties of undefined (reading 'status')
    at /Volume-B/Angel smartAPI/alog-trad-app/node_modules/smartapi-javascript/lib/smartapi-connect.js:99:28
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    /Volume-B/Angel smartAPI/alog-trad-app/node_modules/smartapi-javascript/lib/smartapi-connect.js:99
    if (error.response.status) {

    CODE, using which I am trying:
    let smart_api = new SmartAPI({
    api_key: API_KEY
    });

    smart_api.generateSession(CLIENT_CODE,PASSWORD).then((res)=>{
    console.log('sessionRes:',res);
    }).catch(console.log);

    Please guide me what should I do?