Add api authentication logic