Newer Version Available

This content describes an older version of this product. View Latest

Getting Context in Your Canvas App

When you authenticate your canvas app using signed request, you get the CanvasRequest object (which contains the Context object) as part of the POST to the canvas app URL. If you’re authenticating using OAuth, or you want to make a call to get context information, you can do so by making a JavaScript call.

Getting context data from the Canvas SDK is the most reliable way to identify users. Browsers may not send your canvas app cookies or other identifying data. See Alternatives to Cookies for User Tracking.

Note

The following code sample is an example of a JavaScript call to get context. This code creates a link with the text “Get Context” which then calls the Sfdc.canvas.client.ctx function.