refactoring login authentication using third party libraries