We have a Node.js application whose web page is exposed as a canvas app on Salesforce. This shows the web page on Salesforce and allows users to make visual changes to it (one of our requirements).

We have created a connected app for this purpose and configured the client id and secret in the Node application. It all works fine so far. The trouble comes in when we now need another page also to be shown in Salesforce. We have created a second canvas app with a different canvas app url and oauth. We're now confused which OAuth credentials should be used while connecting from the Node application because from Node perspective, a single instance of Node is contacting a single instance of Salesforce only.

2 Answers 2


Use different callback URLs for the two connected apps (if you are not already), and store the two sets of connected app credentials in your Node app's configuration, indexed by the callback. Now you should be able to get the correct credentials at runtime.

  • Looks like the way forward, thanks. I'm a little grey on using the callback to figure out the right credentials. Can you expand a little on that please ?
    – markgarg
    Commented Oct 24, 2013 at 10:48
  • 1
    In your Node app, you would look at the URL on the incoming request - that tells you which set of credentials should be in play.
    – metadaddy
    Commented Oct 24, 2013 at 16:55

From Spring '15 Salesforce platform release, Connected App supports defining multiple callback URLs. So you can pass one of the callback URL in the redirec_uri parameter and it will be redirected to it.



You must log in to answer this question.

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