Closed nmtoan251998 closed 3 years ago
Additionally, these are my token
and context
values from res.locals
respectively
{
"token": {
"iss": "https://canvas.instructure.com",
"user": "a684e22b-9978-4cef-98d8-98ee5f4cfd6c",
"platformInfo": {
"guid": "OJwJhR6cNZVC9aiyUh8DLT9onnyVif2hOWpa5490:canvas-lms",
"name": "Root account",
"version": "cloud",
"product_family_code": "canvas",
"validation_context": null
},
"clientId": "10000000000004",
"platformId": "8421b0dc94540ac04bdf13cc5f7f4460",
"deploymentId": "24:e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"createdAt": "2020-11-13T03:43:04.941Z",
"platformContext": {
"roles": [
"http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator",
"http://purl.imsglobal.org/vocab/lis/v2/system/person#SysAdmin",
"http://purl.imsglobal.org/vocab/lis/v2/system/person#User"
],
"contextId": "https%3A%2F%2Fcanvas.instructure.com1000000000000424%3Ae7484a3d7fa6e228f44fc0fd50c318add6f918bfe7484a3d7fa6e228f44fc0fd50c318add6f918bf_e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"path": "/",
"user": "a684e22b-9978-4cef-98d8-98ee5f4cfd6c",
"targetLinkUri": "https://localhost:3003",
"context": {
"id": "e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"label": "ACCT300",
"title": "Cost Accounting",
"type": [
"http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering"
],
"validation_context": null
},
"resource": {
"id": "e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"description": null,
"title": null,
"validation_context": null
},
"launchPresentation": {
"document_target": "iframe",
"height": 500,
"width": 500,
"return_url": "http://dvseok.shop/courses/23/external_content/success/external_tool_redirect",
"locale": "en",
"validation_context": null
},
"messageType": "LtiResourceLinkRequest",
"version": "1.3.0",
"endpoint": {
"scope": [
"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem",
"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly",
"https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly",
"https://purl.imsglobal.org/spec/lti-ags/scope/score"
],
"lineitems": "http://dvseok.shop/api/lti/courses/23/line_items",
"validation_context": null
},
"namesRoles": {
"context_memberships_url": "http://dvseok.shop/api/lti/courses/23/names_and_roles",
"service_versions": [
"2.0"
],
"validation_context": null
},
"createdAt": "2020-11-13T03:43:04.957Z"
}
},
"context": {
"roles": [
"http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator",
"http://purl.imsglobal.org/vocab/lis/v2/system/person#SysAdmin",
"http://purl.imsglobal.org/vocab/lis/v2/system/person#User"
],
"contextId": "https%3A%2F%2Fcanvas.instructure.com1000000000000424%3Ae7484a3d7fa6e228f44fc0fd50c318add6f918bfe7484a3d7fa6e228f44fc0fd50c318add6f918bf_e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"path": "/",
"user": "a684e22b-9978-4cef-98d8-98ee5f4cfd6c",
"targetLinkUri": "https://localhost:3003",
"context": {
"id": "e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"label": "ACCT300",
"title": "Cost Accounting",
"type": [
"http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering"
],
"validation_context": null
},
"resource": {
"id": "e7484a3d7fa6e228f44fc0fd50c318add6f918bf",
"description": null,
"title": null,
"validation_context": null
},
"launchPresentation": {
"document_target": "iframe",
"height": 500,
"width": 500,
"return_url": "http://dvseok.shop/courses/23/external_content/success/external_tool_redirect",
"locale": "en",
"validation_context": null
},
"messageType": "LtiResourceLinkRequest",
"version": "1.3.0",
"endpoint": {
"scope": [
"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem",
"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly",
"https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly",
"https://purl.imsglobal.org/spec/lti-ags/scope/score"
],
"lineitems": "http://dvseok.shop/api/lti/courses/23/line_items",
"validation_context": null
},
"namesRoles": {
"context_memberships_url": "http://dvseok.shop/api/lti/courses/23/names_and_roles",
"service_versions": [
"2.0"
],
"validation_context": null
},
"createdAt": "2020-11-13T03:43:04.957Z"
},
Hello, can you show me your package.json so i can confirm the ltijs version (1.3 is way too old).
The error log you showed implies that the error is coming from Canvas, not Ltijs. Can you walk me through the flow of use up until the names and roles call?
Also, do you have access to the canvas logs?
// package.json
{
"name": "ltijs-demo",
"version": "1.0.0",
"description": "Ltijs demo server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "env DEBUG=provider:* node index.js"
},
"keywords": [
"lti",
"ims",
"ltijs",
"1.3",
"imslti"
],
"author": "cvmcosta",
"license": "MIT",
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"ltijs": "^5.3.3",
"ltijs-sequelize": "^2.2.0"
}
}
Hmm you may right, when i tried to access the log from my canvas, it responses an error, not data
How is your Canvas installed? Manually or docker? Some docker images don't work well with LTI (Bitnami).
I installed Canvas manually. Basically I have not made any modification to the source code from its open source version from this repo
Did you do a production installation? More specifically, did you do the Dynamic Settings installation step?
There may be a misconfiguration for my Canvas project, thank you for the helpful guidance!
hello @Cvmcosta , I call menthod getMembers but the member response don't have email and name of user. This is my response
{ id: 'https://lms-dev.zhost.com.vn/api/lti/courses/1/names_and_roles', context: { id: '58d62d469b01f7668d89eb122134a968afee5975', label: 'test', title: 'test' }, members: [ { status: 'Active', user_id: 'e8637b4d-a821-4040-9c92-5c6f452b6902', lti11_legacy_user_id: 'e6e7af12037e588f106302ae894fa2452584db98', roles: [Array] } ] }
Do you know how to config to return member email ?
Hello @GTMtremolo, that depends on the LMS you are using.
On Moodle you have to configure the privacy settings in the Tool registration.
On Canvas you have to set the Privacy level as Public in the Additional Settings
and make sure that "Can retrieve user data associated with the context the tool is installed in." is enabled in the LTI Advantage Services
settings. Have in mind that for Developer Key changes to take effect you also have to delete your App and create a new one.
@Cvmcosta Thank you, it work
Describe the bug I'm trying to retrieve data in class
NamesAndRoles
- functiongetMembers
and get the errorHTTPError: Response code 500 (Internal Server Error)
I have logged the data
platform
from this lineNameAndRolesConsumer
Expected behavior The expected response will be look like the provided response in the documentation in namesandroles
Provider logs Copy of the relevant provider logs.
DEBUG=provider:* npm start
.Screenshots If applicable, add screenshots to help explain your problem.
Ltijs version
NodeJS version
node:12.19.0-alpine
Platform used
Additional context LTI configuration function