Using LTI 1.1 - Auto-Detect User ID of currently logged in user and use it for API calls

Hi Team,

I wanted to know if there is a way to pull the user_id of a currently logged in user?

The reasoning to this is that I have 90% completed an LTI 1.1 API App that allows us to display content to students who are logged into their Brightspace homepage and showing them relevant course information; like an overview of good standing for their currently enrolled courses (assignments due, etc).

I have inserted a pre-defined userID and it is working great, but I am unable to auto-detect the user_id of the student currently logged in.

Is there a way we can pull that userID in question?

# Retrieve the user_id from query parameters, form data, or args
user_id = request.args.get('user_id') or request.form.get('user_id')

This is how I am currently trying to detect the userID in real-time, but I am running into errors, hopefully someone can help steer me in the right direction? If this is not the place for these questions, please let me know where I can find answers.

Tagged: