code refactoring for omniauth 1.0 and oauth 2.0