Warning (4096): Object of class NI\Api\Response could not be converted to string [APP/Vendor/NewestIndustry/NI/Api.php, line 312]

$token returns an object at times when another function expects a string.