Getting Error whilte logging in, unable to Authenticate in Frappe JS SDK

I have installed frappe js sdk via NPM.

I have setup my url and setup loginWithUsernamePassword.

Then I create a new record using db.createDoc.

It seems that I am unable to authenticate using username & password and its assumes me as a Guest.

I am getting below error

exception: 'frappe.exceptions.PermissionError',
exc_type: 'PermissionError',
exc: '["Traceback (most recent call last):\n File \"apps/frappe/frappe/\", line 110, in application\n response = frappe.api.handle(request)\n File \"apps/frappe/frappe/api/**init**.py\", line 49, in handle\n data = endpoint(**arguments)\n File \"apps/frappe/frappe/api/\", line 42, in create_doc\n return frappe.new_doc(doctype, **data).insert()\n File \"apps/frappe/frappe/model/\", line 282, in insert\n self.checkert\n self.check_permission(\"create\")\n File \"apps/frappe/frappe/model/\", line 218, in check_permission\n self.raise_no_permission_to(permtype)\n File \"apps/frappe/frappe/model/\", line 239, in raise_no_permission_to\n raise frappe.PermissionError\nfrappe.exceptions.PermissionError\n"]', _server_messages: '["{\"message\": \"User **Guest** does not have doctype access via role permission for document **Lead**
User **Guest** does not have access to this document\", \"title\": \"Message\"}"]',
_error_message: 'Insufficient Permission for Lead (**create**)',
httpStatus: 403,
httpStatusText: 'FORBIDDEN',
message: 'There was an error while creating the document.'