Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grade ScorePublish code 400 bad request with Canvas

See original GitHub issue

I’m having issues posting a grade in Canvas. I’m trying to run the following inside lti.onConnect() callback:

let grade = {
  scoreGiven: 10,
  activityProgress: 'Completed',
  gradingProgress: 'FullyGraded'

await lti.Grade.ScorePublish(res.locals.token, grade);

The following is the debug output:

provider:gradeService Target platform: +0ms
provider:gradeService Attempting to retrieve platform access_token for [] +3ms
provider:platform Access_token for not found +0ms
provider:platform Attempting to generate new access_token for +0ms
provider:auth Awaiting return from the platform +44ms
provider:gradeService Response code 400 (Bad Request) +320ms

error log:

{ level: 'error',
   'Message: Response code 400 (Bad Request)\nStack: HTTPError: Response code 400 (Bad Request)\n    at EventEmitter.emitter.on (/path-to-test-app/node_modules/got/source/as-promise.js:74:19)\n    at process._tickCallback (internal/process/next_tick.js:68:7)',
  timestamp: '2019-10-14T16:16:14.285Z' }

I can see I don’t have an access token in my database and lti.js is trying to get one from the platform. When I look at the console output of confjwt in Auth.js, it seems like I’m getting the appropriate client ID and endpoint ( before the jwt sign, so I’m not sure why the request is bad.

Does anyone know what I might be doing wrong or can point me to where I can get more debug information?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:60 (30 by maintainers)

github_iconTop GitHub Comments

iceekreeamcommented, Feb 8, 2021

@Cvmcosta Hi sorry as well its been a while. I think the source of my issues was that i was trying to use a production instance of canvas with https with my localhost that was running http. Once i put up the test server on Heroku i did get the two sides communicating. Unfortunately i didn’t finish working on this as i didn’t have the support of my employer to continue. I can say that i was satisfied this would work but obviously to make sure that both the server and canvas are hosted via https

Cvmcostacommented, Oct 16, 2020

Aaaah, i think i get it. I don’t see how you would be able to do this without altering Ltijs.

You would have to change how Platforms are registered (to use Auth0 instead) and then change how these keys and Platforms are retrieved to get this data from Auth0.

But have in mind that Ltijs already provides all of this functionality, i don’t see a reason to use Auth0. As this person said, LTI doesnt have sign-in, it only uses the Client Credentials grant, and all of this functionality is already implemented.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix "400 Bad Request" errors on trying to access ...
"400 Bad Request" errors can be solved by clearing cache and cookies. The cause is very difficult to identify and will differ from...
Read more >
Solved: Re: Error : Your request failed Status copde 400
Chatted with Canvas tech support. Their suggestion is to Add a Page and name the page the same as the name of the...
Read more >
Canvas File Upload 400 Error: Request failed with status code ...
The answer: The Canvas site was at its storage capacity quota. That is, the site had a limit of 3 GB. This explains...
Read more >
Students receiving a Google 400 error message when trying ...
are receiving an error message that says "Google 400. That's an error. The server cannot process the request because it is malformed.
Read more >
LTI (Learning Tools Integration) - Cirrus Help Centre
Scores published in Cirrus automatically appear in the LMS grade book ... is mapped to a Cirrus Candidate role or else candidates will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found