reduce duplicated code in device omniauth callback