Back to All

Javascript SDK Error when login() is called

(edited)

Hey I am trying to log in using javascript sdk but I am getting an error that says

Uncaught (in promise) TypeError: Cannot read property 'toLowerCase' of undefined
    at ie (scdk.js:1)
    at e.<anonymous> (scdk.js:1)
    at u (scdk.js:1)

code:

function connect() {
    requestOptions = {
        method: 'POST'
    }
    fetch("http://localhost:8080/smallcase/authenticate",requestOptions).then(res => {
        res.text().then(async body => {
            console.log(body);
            const scGateway = new scDK({
                gateway: <mygateway>, // Using the gateway that was provided
                smallcaseAuthToken: body,
                config: {}
            });
            await scGateway.initPromise; // This promise is fulfilled.

            await scGateway.login(); // Error thrown here

        });
    })
};

signup method runs fine and the dialog box for smallcase shows up, is there something else that I need to provide?