I've just had a look and when using the Names and Roles service (https://canvas.instructure.com/doc/api/names_and_role.html) and the tool registration has custom variable expansions I also get those variables for each user returned. Here's a snippet of the response I get back on one of our tools:
{
"id" : "https://canvas.ox.ac.uk/api/lti/courses/75998/names_and_roles?rlid=a71fc33bece353a82d335d92931cd70fbfa8eec7&per_page=100",
"context" : {
"id" : "a71fc33bece353a82d335d92931cd70fbfa8eec7",
"label" : "EMT-001",
"title" : "Export Member Test"
},
"members" : [ {
"status" : "Active",
"name" : "Matthew Buckett",
"picture" : "https://secure.gravatar.com/avatar/2af16812634729f02aefa45e87028341?s=128&d=identicon",
"given_name" : "Matthew",
"family_name" : "Buckett",
"email" : "matthew.buckett@it.ox.ac.uk",
"user_id" : "39d7838d-9784-4b7a-b438-04fc0155d4dd",
"lti11_legacy_user_id" : "5de1538afb8f1cab07a03c891df215badaa4d7f7",
"roles" : [ "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor" ],
"message" : [ {
"https://purl.imsglobal.org/spec/lti/claim/message_type" : "LtiResourceLinkRequest",
"locale" : "en-GB",
"https://purl.imsglobal.org/spec/lti/claim/custom" : {
"canvas_user_id" : 2,
"canvas_user_login_id" : "buckett@ox.ac.uk",
"canvas_user_sis_source_id" : null,
"canvas_user_sis_integration_id" : null,
"canvas_user_prefer_high_contrast" : "$Canvas.user.prefersHighContrast",
"com_instructure_brand_config_json_url" : "$com.instructure.brandConfigJSON.url"
},
"https://purl.imsglobal.org/spec/lti/claim/lti11_legacy_user_id" : "5de1538afb8f1cab07a03c891df215badaa4d7f7",
"https://purl.imsglobal.org/spec/lti/claim/lti1p1" : {
"user_id" : "5de1538afb8f1cab07a03c891df215badaa4d7f7"
}
} ]
}]
}