Added funtion auth for authentication.