Closed kevincolten closed 3 years ago
@kevincolten, great to meet you!
CACCL automatically adds all the launch info to the user's session. For a full list of parameters, check out these docs and scroll down to the section on "Launch Parsing": https://github.com/harvard-edtech/caccl-lti
The value you're looking for is courseId
. So on the server, that is accessible as follows:
app.get('/student-names', async (req, res) => {
...
const students = await req.api.course.listStudents({ courseId: req.session.launchInfo.courseId });
...
});
For reference, this is all in the CACCL docs bit.ly/caccl in the server-side section with subheading "Get Info on Status, Auth, and LTI Launch"
If you're building a react app and need the courseId
on the client, visit the CACCL docs bit.ly/caccl and find the client-side section with subheading "Get Info on Status, Auth, and LTI Launch" which walks you through how to get that launchInfo
object on the client.
And if you're having any trouble with any of this, please let me know! I'm happy to help!
@gabeabrams
How do you grab the context for what course you open the LTI in? In the examples, you are passing in an arbitrary course id: