Explain how you would implement secure user authentication and session management in a frontend application.