Does anyone know how to properly call into RESTApi using LCC.getRESTAPISessionKey()?

For example from https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/container_npm_getrestapisessionkey.htm

componentDidMount() {
  let sid = LCC.getRESTAPISessionKey();
  let conn = new JSForce.Connection({accessToken: sid});
  conn.query("SELECT Id, Name from Account LIMIT 50", this.handleAccountQueryResponse);

doesn't work. I believe the CORS is set properly.I get the following error

INVALID_SESSION_ID: This session is not valid for use with the REST API

What is the proper usage of LCC.getRESTAPISessionKey()?

  • Are you writing a container app? If not, this method is not for you. – sfdcfox Apr 10 at 19:32
  • Yes I am writing a container app. – ploc Apr 10 at 19:36

API Access for Apps has been revoked as of winter 18.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.