function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MatrixinlineMatrixinline 

canvasApp parameters not available in oAuth enabled app

Hi , 

 

I have tried to create a Connected App and used it in the visual force page with following code 

 

 <apex:canvasApp applicationName="Saba_Cloud" width="100%" canvasId="my_plan" scrolling="yes" containerId="container1" parameters="{param1:'value1',param2:'value2'}" />

 

my ConnectedApp is oAuth Enabled and uses oAuth WebFlow access 

 

Access Method OAuth Webflow (GET)

 

The issue is I am not getting parameters that I am passing at the time of oAuth or when hitting the sucess URL from salesforce. 

 

Can you please help my why parameters are not passed to my app. 

jhurstjhurst
After you have completed the OAuth flow, you have to submit a call to get the canvas context.  An example javascript looks like:

function contextCallback(msg){
	var html,context;
	if(msg.status !== 200){
	  console.log (msg.status);
	  return;
    }
    Sfdc.canvas(function() {
        var context;
        var uri;

        if (! Sfdc.canvas.oauth.loggedin()) {
            uri = Sfdc.canvas.oauth.loginUrl();
            Sfdc.canvas.oauth.login(
		{uri : uri,
		params: {
                  display : "touch",
		  response_type : "token",
		  client_id : "", //Add Your Consumer ID
		  redirect_uri : encodeURIComponent("") //Add your Callback URL
		}});
        }
        if(Sfdc.canvas.oauth.loggedin()){
	  context = Sfdc.canvas.client.ctx(contextCallback, Sfdc.canvas.oauth.client());
	}
    });


This will set the variable context to be the JSON object with the context from salesforce