Grade ScorePublish code 400 bad request with Canvas
See original GitHub issueI’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: https://canvas.test.instructure.com +0ms
provider:gradeService Attempting to retrieve platform access_token for [https://canvas.test.instructure.com] +3ms
provider:platform Access_token for https://canvas.test.instructure.com not found +0ms
provider:platform Attempting to generate new access_token for https://canvas.test.instructure.com +0ms
provider:auth Awaiting return from the platform +44ms
provider:gradeService Response code 400 (Bad Request) +320ms
error log:
{ level: 'error',
message:
'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 (https://ouruniversity.test.instructure.com/login/oauth2/token) 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:
- Created 4 years ago
- Reactions:1
- Comments:60 (30 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
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.