question-mark
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.

Hosting LTI provider on different domain

See original GitHub issue

I’m attempting to get a development version of a basic LTI instance working with a live production Moodle instance. I’m hosting the tool locally and am attempting to update the grade book of the Moodle instance but am running into a CORS issue where I’m being blocked by the Moodle instance for making a cross-site request.

I have the LTI connecting and loading an HTML page with a button that fires off this function:

function SendGrade () {
            const Http = new XMLHttpRequest();
            const url='https://www.myMoodleURL/grade?ltik=' + ltik;
            Http.open("POST", url);
            Http.send();
}

This request is getting denied for being cross-site since it’s originating from my localhost.

I’m hoping there is a way around this that I’m just missing.

Any help of how I can make my requests into my Moodle instance from a separately hosted domain would be much appreciated.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
michaelerobertsjrcommented, Apr 15, 2020

Thanks @Cvmcosta

Earlier today I figured out that there was some caching in the db so we have been dropping the db between tests to ensure we were getting a fresh session/cookie set.

I’m beginning to think it’s an issue with the version of Moodle or permissions that are different in production.

If you have some time I think a hangout would be helpful. Can you email me at mike at sdcs.io and we can plan a time to jump on a screen share.

1reaction
hank-frankcommented, Apr 14, 2020

Thank you for the super fast response. I’ll give it a shot right now.

On Apr 13, 2020, at 5:57 PM, Carlos Vinícius Monteiro Costa notifications@github.com wrote:

Hello! I think you should be sending the request to your Ltijs instance inteasd of moodle. You should send the request to a /grade endpoint in your Ltijs and then have something like:

lti.app.post(‘/grade’, async (req, res) => { try { const grade = { scoreGiven: 80, activityProgress: ‘Completed’, gradingProgress: ‘FullyGraded’ }

// Sends a grade to a platform's grade line
lti.Grade.ScorePublish(res.locals.token, grade)
return res.send('Grade Succesfully Created')

} catch (err) { return res.status(500).send(err.message) } }) Then the Grade.ScorePublish call will handle sending the grade to your Moodle.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Cvmcosta/ltijs/issues/31#issuecomment-613168393, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTG55PFKC74DMFCFPHVZQTRMOYIDANCNFSM4MHK2G7A.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learning Tools Interoperability (LTI) - Blackboard Help
On the Administrator Panel, under Integrations, select LTI Tool Providers. · Select Register LTI 1.1 Provider. · Type the Provider Domain, such as...
Read more >
Basic Overview of How LTI works - 1EdTech
The basic workflow for using LTI starts when the Instructor or LMS administrator gains access to an externally-hosted learning tool.
Read more >
Publish as LTI tool - MoodleDocs
The 'Publish as LTI tool' enrolment plugin, together with the LTI authentication plugin, allows remote users on a different site (known as an ......
Read more >
Configuring Canvas to support multiple domains
Add multiple domains to Approved Domains · Login to LTI Pro application · Click Manage, then click Configure. · Click Edit Credentials used...
Read more >
Getting Started With LTI - Anthology Dev Docs
That application is defined by its fully-qualified domain name (FQDN). An application can have many FQDNs, but two applications cannot share the same...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found