cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
thilina_kurukul
Community Member

Recieving Canvas logout events to LTI

#javascripts#lti#browsers

We would like to get notify the user logout event from Canvas to our LTI. Notifications we are looking is purely related to browser. For example,

An user log into canvas and navigate to one of LTI UI section. In case user logged out from Canvas, is there a way to listen to this event from LTI side?

Tags (3)
6 Replies
Robbie_Grant
Community Coach
Community Coach

thilina.kurukulasooriya,

Have you had a chance to post your question here Canvas Developers‌?  This is a group for developers or others involved in building SIS, LTI or API integrations within your institution.

Robbie

Robbie

Thank you for the information. I will post this in Canvas Developer group.

Thilina.

peter3
Community Participant

To my knowledge there is no event stream that would be made to an LTI that would expose a 'user logout' event (or any other event).  Once your LTI is launched, it doesn't receive any additional information from canvas (post-launch).

The closest thing I can think of is to instrument your LTI app with a JS listener that listens for the window.onbeforeunload browser event.

However this isn't really giving you the same thing, because this would be giving you the event that the user navigated away from your application .. maybe from logout, or maybe they just clicked on a different nav item.

Additionally you might be able to generate a similar type of datapoint if you have your application send itself a 'heartbeat'  For instance you could make a JS timer that sends a request to the server every N seconds that basically says "User is still alive"  then you could look for the last heartbeat on the backend and if it is greater than N seconds ago, you can assume that the user isn't around anymore and trigger whatever data cleanup routines you want.

ref: javascript - How to Detect Browser Window /Tab Close Event? - Stack Overflow 

26-05-ins-111
Community Participant

Thank you this is really helpful

Robbie_Grant
Community Coach
Community Coach

thilina.kurukulasooriya,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

 

Robbie