Help determining Canvas API user from LTI request

371 views
Skip to first unread message

Jared Wellman

unread,
Feb 10, 2015, 11:07:05 AM2/10/15
to canvas-l...@googlegroups.com
Hello All, 
I'm wondering if it's possible to somehow link an LTI launch with an actual Canvas user from the API perspective.  I'm working on developing an application that is launched via LTI but will also allow a professor to push grades in bulk for multiple assignments.  The LTI launch could be an entry point to the application which could have multiple assignments.  So rather than having an LTI link per assignment which would allow the outcome service to be utilized there will only be a single LTI link.  

However I haven't been able to find an ID that works between the LTI and API.  I believe at one point the LTI launch contained a "custom_canvas_user_id" or similar which did map back for use with the API, but that seems to have gone away?  The LTI launch pass a hash for the user id but using this hash fails on the API side.  

Any suggestions on how to bridge this gap? 

Thanks!
Jared

Becky Kinney

unread,
Feb 10, 2015, 12:16:00 PM2/10/15
to canvas-l...@googlegroups.com
Jared,

I am still seeing the custom_canvas_user_id in my tools. Are you sure
you have your app's privacy level set to public? Whatever id you have,
you should be able to use it in the API by masquerading. See
documentation https://canvas.instructure.com/doc/api/file.masquerading.html.
I have used this successfully to pass grades/comments back in bulk for
a single assignment, and it works fine to make sure that the identity
of the commenter as it appears in the speed grader is correct. Also,
see
https://canvas.instructure.com/doc/api/file.object_ids.html

to translate each student id within the multi-submission endpoint.

HTH,
Becky Kinney
Academic Technology Services
Project Blog
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Canvas LMS Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to canvas-lms-use...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Brad Humphrey

unread,
Feb 10, 2015, 12:40:28 PM2/10/15
to canvas-l...@googlegroups.com
I recommend using variable substitution instead.  If you define a custom variable in your tool configuration with the value $Canvas.user.id canvas will substitute $Canvas.user.id for the user's actual canvas id on tool launch.

You can find the complete list of substitutions here, at lest until we get better documentation for them.

We add new substitutions all the time, but the list of stuff sent based privacy level doesn't change.  Also, privacy level doesn't exist in LTI 2, so using variable substitutions will potentially make upgrading to an LTI 2 tool in the future simpler.


       

Jared Wellman

unread,
Feb 10, 2015, 2:49:34 PM2/10/15
to canvas-l...@googlegroups.com
Becky, 
Indeed that link was set back to private!  Not sure how that happened.  I though I had checked that but I guess not .  

Brad, 
I tried using $Canvas.user.id as a custom value pair:


I see it coming through as custom_my_id.  Also when I first attempted this I had spaces around the equals:


and the output was:
custom_my_id=$Canvas.user.id

So it appears something with the spaces broke this.  Not sure if that's expected or not. 

Thanks again!
Jared
Reply all
Reply to author
Forward
0 new messages