implemented first part of app authentication logic