Auth refactoring. Logic for useing gradle plugin.