Any change required while using token via the Infusionsoft PHP SDK version 1.4?

Keap just informed us that they will be sunsetting API keys. On August 5th, all clients who are still using Legacy API keys will experience service disruption through the actual sunset date of October 31st.

They said the way to ensure no service interruption is to move to their new
“Service Authentication Key- This will fully embrace current authentication methods and retire the existing Legacy Key, to prevent you from having to make additional updates when we revoke all Legacy Keys”

Now, my developer has created token.php script that calls the Infusionsoft API to generate a token and saves it to token.txt

<?php
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
	'clientId'     => 'xxx',
	'clientSecret' => 'xxx',
	'redirectUri'  => $redirect_uri
));

$message = ''; $button = '';

$file = fopen('token.txt','w+');
$token = fread($file, 99999);

if (isset($_GET['code']) and !$infusionsoft->getToken())
{
	fwrite($file, serialize($infusionsoft->requestAccessToken($_GET['code'])));
    $message = 'Requested access token';
}

if ($infusionsoft->getToken())
{    
	$token = serialize($infusionsoft->getToken());
    fwrite($file, $token);
    fclose($file);
    $message = 'Token Saved!';
}
else
{
	$button = '<br /><a href="' . $infusionsoft->getAuthorizationUrl() . '">Click here to authorize</a>';
}

echo $message;
echo $button;
?>

I also have a refresh.php script that re-generates the token every so number of days.

<?php
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
	'clientId'     => 'xxx',
	'clientSecret' => 'xxx',
	'redirectUri'  => $redirect_uri
));

if(($file = fopen(CB_ABS_PATH.'token.txt','r+')) == false)
{
	echo 'File Failed to Open'.PHP_EOL;
}
else
{
	$content = fread($file, 9999);
	$infusionsoft->setToken(unserialize($content));
	$content = $infusionsoft->refreshAccessToken();
	echo serialize($content) . PHP_EOL;
	ftruncate($file,0);
	fseek($file,0);
	fwrite($file,serialize($content));
	fclose($file);
}

Using InfusionSoft PHP SDK version 1.4 while the latest is 1.65

Q: Do I need to change anything in my code to reflect the changes affected by Legacy Key sunsetting ?

Hi @Dave_Lavinsky, your developer is writing code that uses OAuth, and not the Service Account Key.

Keap SDK v1.4 was released 6 years ago, which is quite old. But as that supports OAuth, the code should work. Although you need to test it out to make sure.

Service Account Keys only came out a just a few years ago. I would recommend that you upgrade the SDK to the latest version to be on the safe side, plus you can use that functionality as well.

Note, with OAuth the Access Token lasts for 24 hours, so that needs to be refreshed using the Refresh Token during that period.

So if I do composer update infusionsoft/php-sdk:1.65 but for some reason something’s not working, can I rollback as composer require infusionsoft/php-sdk:1.4 ?

@Bill_Jenkins, you and Dave seem to be doing the same thing. What issues are you encountering?

Or, are you using a different version instead?

It might be a typo in your comment, but the version should 1.6.5 not 1.65. The latest is actually 1.6.6 now though.