Paving the way to nanoionics: atomic origin of barriers for ionic transport through interfaces