Getting Signed Request in Angular 5 Web app integrated with Salesforce Canvas
I am trying to integrate our existing Angular 5 web application into Salesforce canvas. I created Salesforce connected app with OAUTH setting, provided canvas app URL as one of route of existing angular 5 web application.
When I preview the canvas application in "app previewer", it does route to our application (as I am priting simple text on page), but I am not able to read Salesforce context or even get "signed_request".
This is how I tried to get access to "signed_request", but i get error as "ERROR TypeError: Cannot read property 'client' of undefined". I did import "sfdc" from canvas-js-sdk.
import * as sfdc from '@salesforce/canvas-js-sdk';
sfdc.canvas.client.refreshSignedRequest(function(data) {
if (data.status === 200) {
var signedRequest = data.payload.response;
console.log(signedRequest);
var part = signedRequest.split('.')[1];
var obj = JSON.parse(sfdc.canvas.decode(part));
console.log(obj);
}
});
Can someone tell what am I missing here? or Is there another way, I can get hold of "signed_request"?
Thanks in advance.
Salesforce, Canvas, Integration, Web app, Angular 5, sfdc, force.com