Invalid Grant Error

If you're getting the following error when authenticating with the Xero API:

{     "error": "invalid_grant" }

according to the Xero OAuth 2.0 Troubleshooting Guide you might get this error for a number of reasons:

  • The code provided is incorrect, expired or has already been used

The only way to solve this error is to re-authenticate so you can get a new authorization code.

We made a number of changes in v2.1.1 of fmAccounting Link (Xero Edition) to how the Xero Token expiration refresh is calculated and checked, as well as some changes to the fmAccounting Link Single Organisation File to better support multiple user access. These changes can help prevent the "invalid_grant" 400 error - you can view the full details of these changes here.

The Xero API Token Management: Best Practices and Troubleshooting guide also has a lot of useful information.

Still need help? Contact Us Contact Us