Add authentication routine

Not used yet.
Fix compile errors
Auth integrated with existing `transport`