Enhanced login, logout, token handling