Open Al-G2 opened 1 year ago
@mattwire I haven't dug into this but you might have some wisdom?
I'm seeing the same issue on a D7 site. All 4 of the CiviXero scheduled jobs are failing due to "invalid grant".
We have also had the same issue with authorisation on a D7 site since upgrading CiviCRM, CiviXero and AccountSync. Same error as AI-G2 and Upperholme - "invalid_grant". We recently upgraded to 5.59.1 but this did not solve the error.
The system status message sometimes gives false-positives. However I found that previously certain sites would lose authorization and you wouldn't know about it for quite some time (ie. when someone said "why can't I find this contact in Xero"). invalid_grant means that it's not authorized and you need to visit the civicontribute->accounts integration->xero authorize and re-authorize with Xero. I'm not sure why some sites need this extra step on upgrade.
Hi Matt, I've already tried this several times. I logged in today (the civixero buttons have disappeared from the navigation, so I needed to use the link from my browser history) and re-authorised and then tried to run the contact push job directly. I get an invalid grant error. Also the authorisation drops off after a period of time as well but re-authorising does nothing.
Hi Matt, Thanks for the reply. I followed your advice but am still receiving the invalid_grant error. In the XeroAuthorise screen in CiviCRM the Status reports that Civi can connect to Xero. However, when I manually run the CiviXero invoice push job, I still get the invalid_grant error.
FYI - in case this is helpful, here is a post from the Xero developer forum about the invalid_grant error from August last year:
"I managed to fix this. I was expecting a session_state parameter in the refresh token, but there isn't one. As a result of this, I wasn't saving the new access token or refresh token to my database properly, and ended up trying to re-use what was an old refresh token on the next call, which triggered the invalid_grant message." Thanks for your help.
On checking I found that the code version I'm running happing on Wordpress was the latest master & included commits not yet released so I have tagged 2.1.1 in order to get that code out there
Hi Eileen and Matt, Just reporting that I updated CiviXero to 2.1.1 in our D7 site and the "invalid_grant" error is gone and we are able to push invoices to Xero once more. Thanks for your help. :)
@Newbie401 yay
Thanks Eileen and Matt, I now have it semi-working - the sync is working but the authorisation is dropping out and every 30 minutes I have to re-authorise. Is there any setting I can apply to get it to stick?
In my case Civi is also repeatedly reporting that the authorisation needs to be refreshed. @mattwire said earlier in this thread that this is a known issue, but I'm unclear as to whether the authorisation actually needs to be re-established, or whether the reporting is broken and it is incorrectly stating that re-authorisation is required?
@Upperholme @Al-G2 @Newbie401 - @mattwire has put up #126 - can one of you check if it works for you? If so I will merge & tag a release
@eileenmcnaughton I have downloaded the current version from https://codeload.github.com/eileenmcnaughton/nz.co.fuzion.civixero/zip/refs/heads/master, unpacked that to the extension folder (wp-content/uploads/civicrm/ext ), removed the master from the directory name to match the extension and unfortunately it still isn't automatically renewing. Will clearing the cache make any difference?
@Al-G2 You need the contents of patch from #126 as well
@mattwire I seem to have successfully applied the patch but no luck - I've checked the logs and I can't see any errors. There seems to have been a change - I need to fully authorise each time, I think it was a shorter process before.
@Al-G2 I pushed some changes to master that help me - can you try the latest master?
I think 2.1.4 should fix
Our CiviCRM instance was upgraded CiviXero before the most recent update of AccountSync and we had to disable the CiviXero plugin at this point due to the errors caused. After I re-enabled the extension with the new release of AccountSync We now have an issue with authorisation. While the authorisation process works correctly, running scheduled jobs gives an "invalid grant" error which is as I understand it, is related to authorisation. I've checked the Xero side and there's nothing in the recent history.
One other point - although the authentication works initially after some time there's a notification that re-authentication is required