Open Pavikam opened 3 years ago
I was having issues as well. I ended up completely removing calcinai/xero-php
composer remove calcinai/xero-php
and then reinstalled it
composer require calcinai/xero-php
that seemed to resolve my immediate issue. Also be sure that your provider info is set properly, including the redirect url. They have to match the defined OAuth2 app that you've setup through the Xero developer portal.
Hi,
My PHP site has been using Xero oAuth1.0 with calcinai/xero-php ^1.8 for a long time now and have had no issues. Now that we need to upgrade to oAuth2, I upgraded my package to ^2.2. And after that, the site does not connect to Xero, nor does it even go into the function code in the first place. It just goes inactive after it hits the code.
File name: xerofunction.php
session_start();
$provider = new \Calcinai\OAuth2\Client\Provider\Xero([ 'clientId' => '{xero-client-id}', 'clientSecret' => '{xero-client-secret}', 'redirectUri' => 'https://example.com/callback-url', ]);
if (!isset($_GET['code'])) {
// Check given state against previously stored one to mitigate CSRF attack } elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
} else {
}
Just had the above code given by you to start with. Of course, I substituted the client, secret and redirect url. After a purchase, the site went inactive, whereas it should have posted the data into Xero. I tried commenting the whole code above, and just doing an echo. Still the same.
The only way I could resolve was by reverting to the older ^1.8 version and the code for the same.
Can you please help me get it upgraded and working? Thanks in advance.