From 4ebd10e0c572a8202c53b0fe9a8a67b923cdd33f Mon Sep 17 00:00:00 2001 From: Adeyemi Aina Date: Wed, 11 Sep 2024 01:24:38 -0400 Subject: [PATCH] debug lti scope issue --- app/services/lti13_service/get_ags_access_token.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/services/lti13_service/get_ags_access_token.rb b/app/services/lti13_service/get_ags_access_token.rb index 1f100ac8..b72a4f8f 100644 --- a/app/services/lti13_service/get_ags_access_token.rb +++ b/app/services/lti13_service/get_ags_access_token.rb @@ -11,6 +11,14 @@ def call Rails.logger.info "Fetching client assertion from ClientCredentialsJwt" client_assertion = Lti13Service::ClientCredentialsJwt.new(@lms_instance).call Rails.logger.info "Client assertion (JWT) generated: #{client_assertion}" + + # debug the LTI claims and scopes pulled from lti scopes & claims + Rails.logger.info "LTI claims and scopes configuration: #{Rails.configuration.lti_claims_and_scopes.inspect}" + Rails.logger.info "Line Item Scope: #{Rails.configuration.lti_claims_and_scopes['ags_scope_line_item']}" + Rails.logger.info "Result Scope: #{Rails.configuration.lti_claims_and_scopes['ags_scope_result']}" + Rails.logger.info "Score Scope: #{Rails.configuration.lti_claims_and_scopes['ags_scope_score']}" + Rails.logger.info "Names and Roles Scope: #{Rails.configuration.lti_claims_and_scopes['names_and_roles_scope']}" + # Build the request body for the token request request_body = { grant_type: 'client_credentials', @@ -24,6 +32,9 @@ def call client_assertion: client_assertion }.to_query + # Log the complete request body + Rails.logger.info "Request body with scopes: #{request_body}" + # Establish a connection to the LMS's OAuth2 endpoint using Faraday conn = Faraday.new(url: @lms_instance.oauth2_url) do |faraday| faraday.headers['Content-Type'] = 'application/x-www-form-urlencoded'