Connect Xero to n8n?
This guide shows how to Connect Xero to n8n using OAuth2 in a few clear steps. You can connect Xero to n8n by creating a Xero app, adding the OAuth2 redirect URL, entering the client ID and secret into n8n, and then authorizing the account.
What You Need
- An n8n Cloud account or an n8n Docker host with a public URL.
- A Xero developer account at developer.xero.com.
- ngrok or another tunnel if you host n8n locally.
- Basic terminal access for Docker or ngrok commands.
How to Connect Xero to n8n (OAuth2)
Follow these numbered steps to set up OAuth2 and authorize Xero inside n8n.
Step 1: Create a Xero App
- Sign in at https://developer.xero.com and open “My Apps”.
- Click “New app” and fill the app name and company details.
- For Redirect URI use your n8n callback URL:
https://your-n8n-domain/rest/oauth2-credential/callback. - Save and copy the Client ID and Client Secret.
Step 2: Prepare n8n (Docker example)
If you run n8n locally you need a public webhook URL. Use ngrok or set WEBHOOK_TUNNEL_URL.
# Run ngrok to expose n8n on port 5678
ngrok http 5678
# Example docker run with tunnel URL set
docker run -it --rm \
-p 5678:5678 \
-e N8N_HOST="localhost" \
-e N8N_PORT=5678 \
-e WEBHOOK_TUNNEL_URL="https://.ngrok.io" \
n8nio/n8n:latest
If you use n8n Cloud, you do not need ngrok. Use your cloud instance URL as the redirect.
Step 3: Add Xero OAuth2 Credentials in n8n
- Open n8n web UI and go to Credentials > New > Xero OAuth2.
- Enter the Client ID and Client Secret from Xero.
- Set Scopes to a minimal set, for example:
openid profile email accounting.transactions accounting.contacts. - Click Connect and follow the Xero consent screen to authorize.
Step 4: Build a Simple Workflow
Add a Xero node and pick an operation like “Create Contact” or “Get Invoices.” Use the credential you created. Save and execute the workflow to test.
# Example: trigger a webhook manually using curl (replace URL)
curl -X POST https://your-n8n-domain/webhook-test -H "Content-Type: application/json" -d '{"name":"Test"}'
Update
If you change the Client Secret in Xero, open the Xero credential in n8n and update the secret. Reconnect the credential if authorization fails. Keep n8n and its Docker image up to date to receive OAuth fixes.
Security
- Use HTTPS for your n8n URL. Do not use plain HTTP in production.
- Restrict Redirect URIs in the Xero app settings to your exact n8n callback URL.
- Store Client Secret in n8n credentials, not in workflows or logs.
- Limit scopes to the minimal permissions needed for your automation.
- Rotate client secrets periodically and remove unused apps or credentials.
Done
You now have Xero connected to n8n using OAuth2. Test basic operations like listing contacts or invoices. Expand the workflow with triggers and conditional nodes as needed.