Closed MarcVanDaele90 closed 2 years ago
Inside lti.onConnect
, try return lti.redirect(res, "https://app.wijsr.com/");
instead of return res.redirect("https://app.wijsr.com/");
Thanks for the suggestion. Unfortunately, I get the same result (and same logging). Based on my logging (the missing "onConnect" logline), I think onConnect is not called (which could explain why your suggested change has no effect).
Maybe I misunderstand when the onConnect is called exactly and where I should launch my actual tool?
I think I found the problem. Inspecting your logs and comparing them to mine, here's what I see:
Yours:
2022-07-31T17:11:26.852Z provider:auth Successfully validated token!
2022-07-31T17:11:27.149Z provider:main Generating ltik
2022-07-31T17:11:27.150Z provider:main Redirecting to endpoint with ltik
Function execution took 741 ms. Finished with status code: 302
Mine:
2022-08-01T16:15:19.301Z provider:auth Successfully validated token!
2022-08-01T16:15:20.358Z provider:main Generating ltik
2022-08-01T16:15:20.359Z provider:main Forwarding request to next handler
After Forwarding request to next handler
, my lti.onConnect()
handler is called.
Looking at ltijs' codebase here, it looks lti.onConnect() is called because I have ltiaas
set to true
:
lti.setup("LTIKEY",
{
plugin: new Firestore(),
},
{
ltiaas: true,
// other settings
},
);
Yours is missing the ltiaas
setting.
I did a little bit more testing. When I don't specify ltiaas: true
, I get the Redirecting to endpoint with ltik
log just like you do, but it still calls my lti.onConnect()
callback. Are you sure your lti.onConnect()
is not being called?
When adding ltiaas:true
the redirect to my app works indeed! Thanks for having this detailed look. That's appreciated a lot!
I can confirm that in this case I do see the onConnect logline. However, I don't see it without this ltiaas:true
I'm still a bit confused by the "Path does not match reserved endpoints" logline. Is this expected behavior or should I fix something there?
Glad to see that it's working now.
Regarding Path does not match reserved endpoints
, the logic is here:
https://github.com/Cvmcosta/ltijs/blob/master/src/Provider/Provider.js#L211-L214
You can see in the comments when it gets logged.
Thanks for your assistance! Feel free to close the issue.
And thanks for clarifying Path does not match reserved endpoints
. When reading this, it sounds like something was configured incorrectly while it seems to be expected behavior, right?
Maybe (minor suggestion), it might be useful to rephrase this logline?
@Cvmcosta please close this issue
Thank you so much @johnnyoshika For assisting in this issue. I will consider rephrasing the Path does not match reserved endpoints
sentence.
Describe the bug I assume that, after a succesfull login, that onConnect would get called, right? In there I should redirect to my actual app, right? This does not seem to happen. I have the folowing setup
I've added this external tool to a Moodle course and started the course.
This resulted in the following firebase/ltijs logging
At first sight, the logging seems to be OK (except maybe the "Path does not match reserved endpoints"?) but I would expect to see a logline for 'onConnect' at the end and a redirect to
This does not seem to happen and Moodle just shows the following
Any suggestions on what I could try?
Ltijs version "@examind/ltijs-firestore": "^0.1.7", "firebase-admin": "^10.0.2", "firebase-functions": "^3.18.0", "ltijs": "^5.8.9"
NodeJS version
Platform used