refactor credential callbacks