validating authentication and making the function async