Fixed infinite loop when getting auth token