Skip to content

Xero OAuth "invalid_grant" when refreshing an access token

Updated

The Xero token endpoint returns invalid_grant during refresh. Check which refresh token the next run loads.

The Xero token endpoint returns invalid_grant during refresh. Check which refresh token the next run loads.

What we checkedWhere
Xero OAuth token errorsdeveloper.xero.com
Xero refresh request fields and token rotationdeveloper.xero.com
Report of invalid_grant after reading a stored tokenstackoverflow.com

Check it yourself

  • Check the request to POST /connect/token. A refresh uses grant_type=refresh_token and the stored refresh_token.
  • After a successful refresh, save both returned tokens. Check what the next scheduled run loads. In the linked report, the refresh path received a new token set but only the initial authorization path saved it.
  • If the refresh response was lost, Xero allows reuse of the previous token for 30 minutes. An unused refresh token expires after 60 days. If you have no usable refresh token, reconnect the app through Xero’s authorization flow.

Still failing?

Send the error text, grant type and whether the last refresh was saved to money@iftodo.ai. Leave out all token values and the client secret.

Weekly sync checks for €29 a month

For one Shopify or Square to QuickBooks workflow, we check weekly exports for missing or duplicate records and email you when we find a mismatch. We run a sample first to see whether the two exports have matching references.

Ask for a sample check. We agree how to share exports before starting billing. Cancel by email before your next renewal.