Note: Before using sfapi, take the following steps Add your lightning domain (ends with lightning.force.com) to the CORS list under Setup. Add your classic domain to CSP Trusted Sites list under Setup.