That's because of the session time out I believe which is set in the server. Please refer to the image below.
You can modify the App timeout to a greater number which helps you delay the time out period. But....
I would say that having low App time outs is a very good thing because if you have a longer App time out and the user forgets to log off, its going to consume extra sessions.
As an alternative to your issue, I would suggest you to invoke a pop up message saying that the session has logged out since it was idle for a long time. This way the user can be notified and can possibly curtail his frustration
Yeah, on a mashup throwing up a message saying that the session had been idle for a long time should be the way to go. Just to make sure that the user knows what has happens, why it has happened and what has to be done like the way QlikSense hub does.