Newer Version Available

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

CanvasRequest

When you use a signed request for authentication in your canvas app, you receive a CanvasRequest object in the initial POST message from Salesforce. This object contains fields related to the request, and also contains the Context and Client objects. The CanvasRequest object is returned in JSON format and contains the following fields.

Field Description
algorithm The algorithm used to sign the request.
issuedAt The timestamp when the oauthToken was issued.
userId The context user’s ID.

The following code snippet shows an example of the CanvasRequest object.

1{
2    "context":
3    {
4        "application": 
5        {
6            "applicationId":"06Px000000003ed", 
7            "authType":"SIGNED_REQUEST", 
8            "canvasUrl":"http://instance.salesforce.com:8080
9                /canvas_app_path/canvas_app.jsp", 
10            "developerName":"my_java_app",
11            "isInstalledPersonalApp": false, 
12            "name":"My Java App", 
13            "namespace":"org_namespace", 
14            "options":[],
15            "referenceId":"09HD00000000AUM", 
16            "samlInitiationMethod":"None",
17            "version":"1.0.0"
18        },
19        "user":
20        {
21            "accessibilityModeEnabled":false, 
22            "currencyISOCode":"USD", 
23            "email":"admin@6457617734813492.com", 
24            "firstName":"Sean", 
25            "fullName":"Sean Forbes", 
26            "isDefaultNetwork":false, 
27            "language":"en_US", 
28            "lastName":"Forbes", 
29            "locale":"en_US", 
30            "networkId":"0DBxx000000001r", 
31            "profileId":"00ex0000000jzpt", 
32            "profilePhotoUrl":"/profilephoto/005/F", 
33            "profileThumbnailUrl":"/profilephoto/005/T", 
34            "roleId":null, 
35            "siteUrl":"https://mydomain.force.com/", 
36            "siteUrlPrefix":"/mycommunity", 
37            "timeZone":"America/Los_Angeles", 
38            "userId":"005x0000001SyyEAAS", 
39            "userName":"admin@6457617734813492.com", 
40            "userType":"STANDARD"
41        }, 
42        "environment": 
43        { 
44            "parameters":
45            {
46                "complex":
47                {
48                    "key1":"value1",
49                    "key2":"value2"
50                },
51                "integer":10,
52                "simple":"This is a simple string.",
53                "boolean":true
54            },
55            "dimensions": 
56            { 
57                "clientHeight":"50px", 
58                "clientWidth":"70px", 
59                "height":"900px", 
60                "width":"800px", 
61                "maxHeight":"2000px",
62                "maxWidth":"1000px"
63
64            }, 
65            "record": 
66            {
67                "attributes": 
68                {
69                    "type":"Account",
70                    "url":"/services/data/v36.0/sobjects/Account/001xx000003DGWiAAO"
71                },
72                "Id":"001xx000003DGWiAAO",
73                "Phone":"(555) 555-5555",
74                "Fax":"(555) 555-5555",
75                "BillingCity":"Seattle"
76            },
77            "displayLocation":"Chatter",
78            "locationUrl":"http://www.salesforce.com/some/path/index.html", 
79            "subLocation":null,
80            "uiTheme":"Theme3",
81            "version": 
82            { 
83                "api":"36.0", 
84                "season":"SUMMER" 
85            }, 
86        }, 
87        "organization":
88        {
89            "currencyIsoCode":"USD", 
90            "multicurrencyEnabled":true, 
91            "name":"Edge Communications", 
92            "namespacePrefix":"org_namespace", 
93            "organizationId":"00Dx00000001hxyEAA"
94        },
95        "links":
96        {
97            "chatterFeedItemsUrl":"/services/data/v36.0/chatter/feed-items", 
98            "chatterFeedsUrl":"/services/data/v36.0/chatter/feeds", 
99            "chatterGroupsUrl":"/services/data/v36.0/chatter/groups", 
100            "chatterUsersUrl":"/services/data/v36.0/chatter/users", 
101            "enterpriseUrl":"/services/Soap/c/36.0/00Dx00000001hxy", 
102            "loginUrl":"http://login.salesforce.com",
103            "metadataUrl":"/services/Soap/m/36.0/00Dx00000001hxy", 
104            "partnerUrl":"/services/Soap/u/36.0/00Dx00000001hxy", 
105            "queryUrl":"/services/data/v36.0/query/", 
106            "recentItemsUrl":"/services/data/v36.0/recent/", 
107            "restUrl":"/services/data/v36.0/", 
108            "searchUrl":"/services/data/v36.0/search/", 
109            "sobjectUrl":"/services/data/v36.0/sobjects/", 
110            "userUrl":"/005x0000001SyyEAAS" 
111        }
112    },
113    "client":
114    {
115        "instanceId":"06Px000000002JZ", 
116        "instanceUrl":"http://instance.salesforce.com:8080", 
117        "oauthToken":"00Dx0000X00Or4J!ARQAQJ34YL8gKowP65p8FDHkvk.Uq5...", 
118        "refreshToken":"00DD0000000K1NM!ARAAQGJVGOyMjh1jjqvShRpLuAq0...", 
119        "targetOrigin":"http://instance.salesforce.com:8080"
120    }, 
121"algorithm":"HMACSHA256", 
122"userId":"005x0000001SyyEAAS", 
123"issuedAt":null
124}