Refactor github authentication