When a timeout occurs, users are automatically disconnected from the application and directed to the login page. After logging back into the app, on what page users should be directed? The home page or the page they were on before being logged out? And should the data entered before the log-out be saved or not?
I can propose the next few solutions, you can use a more suitable version for your scenario:
Redirect users to the page they were on before being logged out: This improves the user experience by allowing them to pick up where they left off. It reduces the friction of having to navigate back to the page they were working on.
Save the data entered before the log-out: If possible, save any unsaved data or work in progress automatically, either on the client-side (e.g., using browser storage) or server-side (e.g., using temporary drafts). This can help prevent data loss and minimize user frustration. However, you should ensure that the data storage method complies with security and privacy best practices.
Context matters here.
Returning to the task is nice for users who were logged out for security purposes and want to resume what they were doing. We see this pattern in SAAS systems, where the user might be deep into the hierarchy of the platform and working on something that was interrupted by a break or a phone call.
Returning to the home screen is better when the user was logged out without likely being in the middle of important work. An example would be a banking app - the user checks their balance, drills into their savings account to look at recent transactions, and leaves the app. The next time the user logs in, they'd expect to see their home screen with overall balance info, not the individual transactions in their savings account.
How do you find out which is better for your case? Study the jobs to be done. What is the user usually doing at the point when the system logs them out? Is logout/reauthentication a common pain point in user feedback, suggesting that the user's tasks are being interrupted without an easy way to return to them? Doing some research would be helpful.
I assume this happens when the user is in the middle of a task inside the app.
Definitely not making users restart their tasks is the best idea. Works for all use cases everywhere in the journeys so it's scalable and consistent for the user. This includes the data they input and have not yet saved as well.
Additional points, would be great if the login is not in the form of full page where the user will be surprised, mad, and even abandon/quit the app. Maybe in form of bottom sheet where it shows the background of their last page and the data they input are still there will create a better UX.