Get user info returning sid as guest

/api/method/frappe.realtime.get_user_info returning cookie with sid as guest.
due to which my other api is not working as the client side getting not permitted error.