What we are trying to achieve: To auto populate the Access Code of the Quiz/Exam on canvas quiz page.
Detailed Description: From our page student will be redirected to Canvas Quiz/Exam page on button click action to a target=’_blank’ of a browser.
Once the student reaches to the Quiz’s Access Code entry page, we need to auto populate password into the Access Code input field present on the page or bypass manually entering the AccessCode(by providing Access code via validate Access_code Quiz API) page and launch Quiz page directly so that student can proceed with Quiz/Exam.
What we tried till now:
Case 1: Load canvas page in our page in a Frame and we will be somehow finding the control from the frame and auto populate the access code.
Action: Tried to load canvas page in Frame.
Result: Canvas page doesn’t allow to load in a Frame and throws ‘X-Frame-Options’ set to ‘same origin’ exception.
Case 2: Use Canvas APIs to auto populate access code on to the page internally and bypass the page automatically to exam page.
Action: Found a API endpoint to validate access_code in canvas, POST /api/v1/courses/:course_id/quizzes/:id/validate_access_code which Accepts an access code and returns a Boolean indicating whether that access code is correct (According to API description).
Verdict: Documentation says this endpoint is BETA, This API endpoint is not finalized, and there could be breaking changes before its final release.
Result: We are able to post access code to this endpoint and result is ‘200 OK’ but as this call is CORS, unable to catch success callback of AJAX POST and we can’t proceed to exam page.
Suggestions/Support needed: Do we have any end point that takes access code and returns the status, exam URL and also CORS enabled so that we can directly launch Quiz page without entering Access Code manually ?