Implemented api authentication