Add an authentication timeout.
Define channel types better, rename auth function