diff --git a/lti/views.py b/lti/views.py index f962104d..b5e2bff2 100644 --- a/lti/views.py +++ b/lti/views.py @@ -10,6 +10,7 @@ Implements the LTI 1.3 / LTI Advantage flow: - Manual NRPS Sync """ +import json import logging import traceback import uuid @@ -263,6 +264,19 @@ class LaunchView(View): request.session.modified = True logger.error(f"[LTI LAUNCH DEBUG] Stored media_token in session: {media_token}") + # Handle lti_message_hint from custom claims + lti_message_hint_str = custom_claims.get('lti_message_hint', '') + if lti_message_hint_str: + try: + message_hint_data = json.loads(lti_message_hint_str) + if isinstance(message_hint_data, dict): + # Store in session for later use + if 'lti_session' in request.session: + request.session['lti_session']['message_hint'] = message_hint_data + request.session.modified = True + except (json.JSONDecodeError, ValueError): + pass + LTILaunchLog.objects.create(platform=platform, user=user, resource_link=resource_link_obj, launch_type='resource_link', success=True, claims=claims) redirect_url = self.determine_redirect(launch_data, resource_link_obj)