0

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()?

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

1 Answer 1

0

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

https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/rn_lc_api_revert_cruc.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .