Adding direct authentication to get API token and raising errors