Spin transport in metal and oxide devices at the nanoscale