Cvmcosta / ltijs

Turn your application into a fully integratable LTI 1.3 tool provider.
https://cvmcosta.github.io/ltijs/
Apache License 2.0
306 stars 70 forks source link

Error setting grade using ltijs #241

Open jpsandovaln opened 2 weeks ago

jpsandovaln commented 2 weeks ago

Describe the bug When try to set grade an error is displayed

         const gradeObj = {
          userId: idtoken.user,
          scoreGiven: score,
          scoreMaximum: 100,
          activityProgress: 'Completed',
          gradingProgress: 'FullyGraded'}

        const responseGrade = await this.lti.Grade.submitScore(idtoken, lineItemId, gradeObj)

Reviewing the submitScore function the problem occurs in the following lines

const accessToken = await platform.platformAccessToken(scopes.join(' ')); the value for scopes is: const scopes = ['https://purl.imsglobal.org/spec/lti-ags/scope/score'];

Expected behavior Set grade without issues

Provider logs HTTPError: Response code 404 (Not Found) at Request. (/home/paolo.sandoval/master-quiz-lti/server/node_modules/got/dist/source/as-promise/index.js:118:42) at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1731354953859, socket: 1731354953859, lookup: 1731354953859, connect: 1731354953859, secureConnect: 1731354953859, upload: 1731354953859, response: 1731354954048, end: 1731354954165, error: undefined, abort: undefined, phases: { wait: 0, dns: 0, tcp: 0, tls: 0, request: 0, firstByte: 189, download: 117, total: 306 } } }

Ltijs version "ltijs": "^5.9.5"

NodeJS version v20.18.0

Platform used Canvas

Additional context I am using typescript for my current project but I see the same error with you the example on github

siddrc commented 3 days ago

Hello @jpsandovaln are you still facing this issue..ping me on discord I would like to help , here is my id siddharthroyc_97017 Also I have article on this https://medium.com/@debu2in/implementing-ltiv1-3-using-ltijs-1ab38ab87567

Just wanna helps folks out there who are trying to make sense of this lovely library :) and I can say this with confidence coz I have stuff in PROD using this library and only after I figured stuff out I realised this library does literally everything 👍🏻