lticanvas-lms

Login required error in Canvas lms for an LTI 1.3 Tool launch


I'm trying to launch an LTI 1.3 tool from canvas lms. I'm getting the error login_required with the error description Must have an active user session after sending the parameters as specified in step 2(authentication request) as per the official documentation. This is not happening while I try from a public course. I went through the source code and found that the error is occurring around here.

This is due to a missing user session. For some reason, @current_user is empty for me. However, I am logged in and am trying to access the tool. I don't know why this error is happening. I have been at this for a week. It would be nice if anyone could throw some light on this.

I found a similar query in the canvas developer community but it's unanswered.


Solution

  • There are many reasons why this can happen. Personally, for me, I was doing a server-to-server call instead of a simple redirect. Hence canvas couldn't validate the user session. I changed and it's working for me. I'm posting this in case anyone stumbles up on this issue. This is mentioned in the documentation and I missed it earlier.