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 checked | Where |
|---|---|
| Xero OAuth token errors | developer.xero.com |
| Xero refresh request fields and token rotation | developer.xero.com |
| Report of invalid_grant after reading a stored token | stackoverflow.com |
Check it yourself
- Check the request to
POST /connect/token. A refresh usesgrant_type=refresh_tokenand the storedrefresh_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.