Added check for token NULL value before saving following 401 

If the token header is NULL (as it would be for a 401) and this is saved, the subsequent authorisation attempt is impossible since the existing token has been overwritten.
Updated API.php to throw an exception when a new token is requested but a token already exists
Merge pull request #4 from croxton/master

Throw an exception if a token cannot be obtained, instead of saving a null token.