Skip to content

Commit

Permalink
Changes to ensure that this code works corectly
Browse files Browse the repository at this point in the history
Without "$_SESSION['token'] " if the page is refreshed there will be an error message.
  • Loading branch information
phillbooth authored Sep 9, 2016
1 parent a2197e6 commit 7f1866d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Or manually add it to your composer.json:
The client ID and secret are the key and secret for your OAuth2 application found at the [Infusionsoft Developers](https://keys.developer.infusionsoft.com/apps/mykeys) website.

```php

if(empty(session_id();)) session_start();

require_once 'vendor/autoload.php';

$infusionsoft = new \Infusionsoft\Infusionsoft(array(
Expand All @@ -55,7 +58,7 @@ if (isset($_SESSION['token'])) {
// If we are returning from Infusionsoft we need to exchange the code for an
// access token.
if (isset($_GET['code']) and !$infusionsoft->getToken()) {
$infusionsoft->requestAccessToken($_GET['code']);
$_SESSION['token'] = serialize($infusionsoft->requestAccessToken($_GET['code']));
}

if ($infusionsoft->getToken()) {
Expand Down

0 comments on commit 7f1866d

Please sign in to comment.