I am working on an integration between a Portal written in Angular and a Salesforce Org.
To better test this during development I want to connect my local Angular code with my scratch org.
To receive data from SF we use Remote API and starting from Monday (after Winter release) we are having an issue with receiving responses from Salesforce.
To make the connection I authorize an org, make
sfdx force:org:display -u ${alias}
get token and url from this information and launch portal locally on port 4200. I use this information from the org to make requests to Salesforce:
POST method to https://business-agility-7203-dev-ed.my.salesforce.com/apexremote
Accept: 'application/json',
Content-Type: 'application/json',
Authorization: `Bearer ${ACCESS_TOKEN}`,
BODY action: "Controller" ctx: {csrf: "", vid: "0661", ns: "", ver: 48} csrf: "" ns: "" ver: 48 vid: "0661" method: "getCurrentUser" tid: 1 type: "rpc"
Salesforce response with that error
action: "Unknown"
data: ""
message: "Remoting request invalid for your session. Refresh the page and try again"
method: "Unknown"
ref: false
statusCode: 402
type: "exception"
vfDbg: true
vfTx: true
where: ""
I’ve tried to connect with other orgs, to use Postman and received the same error. We think that the possible problem can be connected with the CSRF token. But we don't know how to request CSRF Token or where I can get it to use in my request.