Progress with authentication, relates to issue #44
- Added several functions to deal with authentication and tokens
- Added tests