Power BI and Xero: Automating Your Accounting Data Refresh
- RequestRocket

- Jul 14
- 4 min read
Updated: Oct 5
Introduction to Power BI and Xero Integration
Power BI’s out-of-the-box “Web” connector accepts Basic credentials. However, it cannot natively refresh OAuth 2.0 tokens in the Power BI Service. This limitation can be a significant hurdle when you want accounting data from Xero to refresh automatically in the cloud. Fortunately, RequestRocket provides a solution. It translates Xero’s OAuth 2.0 flow into a Basic credential that Power BI understands, without ever exposing your access or refresh tokens. Follow the workflow below, and you will have a live Xero dataset refreshing in Power BI in about 10 minutes.
Prerequisites
Before you begin, ensure you have the following:
Step 1: Register a “Web App” in Xero
Sign in at developer.xero.com → My Apps → New App.
Select Web app and fill out the form:
App name: PowerBI (or any descriptive name)
Company URL: https://requestrocket.com
Redirect URI: https://app.requestrocket.com/webhooks/oauth2
Agree to the T&Cs and click Create app.
On the next page, copy the Client ID, then click Generate a secret and copy that too.

Create a Web App

Take note of your ClientID and Secret
Step 2: Create an OAuth 2 Target Credential in RequestRocket
Go to Credentials → New → Name: Xero Target Credentials.
Set Type: target | Auth type: OAuth2.
Populate the Secret section as follows:
Grant type: Authorization Code
Client ID (from Xero)
Client Secret (from Xero)
Authorization URL: https://login.xero.com/identity/connect/authorize
Access Token URL: https://identity.xero.com/connect/token
Redirect URI: https://app.requestrocket.com/webhooks/oauth2
Scope: offline_access accounting.reports.read accounting.transactions read accounting.settings openid profile email accounting.contacts
Token prefix: Bearer (leave default)
Add to Header: ✔️ checked
Click Create, then choose Authenticate. Xero will open, ask for consent, and redirect back. You should see Authentication Successful.

Create an Oauth2 Target Credential

Enter all the OAuth2 authorization code details

Log into Xero and accept the request
Step 3: Create a Target for the Xero Accounting API
Go to Targets → New → Name: Xero API.
Set Base URL: https://api.xero.com/.
Attach the OAuth 2 credential you just created.

Create a target route
Step 4: Create a Basic Credential for Power BI
Go to Credentials → New → Name: UserName Password.
Set Type: proxy | Auth type: Basic.
Enter any username you like and let RequestRocket generate a secure password.

Create a username/password Proxy Credential
Make sure to copy these values somewhere safe. Power BI and the on-prem gateway will use them.
Step 5: Build the Proxy that Ties Everything Together
Go to Proxies → New → Name: Xero API Proxy | Enable toggle Active.
Set Proxy Credential: UserName Password (from step 4).
Set Target: Xero API | Target Credential: Xero Target Credentials.
Leave Additional Headers blank for now.
Click Create. Note the Base URL that appears, for example, https://ap-southeast-2.requestrocket.com/api/e910b056-bb22-4e34-a1fe-c1234567899d.

Create a Proxy that links your Proxy Credential, Target and Target Credentials
Step 6: List Your Xero Tenants (First Request)
The first call returns the tenantId that Xero expects on every data request.
In Power BI (or Postman), set GET to `{proxyBaseUrl}/connections`.
Choose Basic Auth and enter the username and password from step 4.
Send the call and copy the tenantId from the response.

Make a Web Request - Enter your Proxy Base URL and append the "Connections" endpoint

Authenticate with your Proxy Credential username and password

Take note of your TenantID
Step 7: Pin the Tenant ID to the Request Header via the Proxy
It's crucial not to skip this step. Power BI only allows headers to be added on web requests made anonymously. This poses a risk as your credentials may be exposed in the code. To ensure security, we need RequestRocket to add those headers instead of Power BI.
In the proxy Edit page, set an additional header:
Now Power BI no longer needs to send that header, which it can't do if you're using a Basic authenticated web request.

Update the Proxy with additional Headers
At this point, we have everything we need to make authenticated calls From Power BI → Via RequestRocket → To Xero.
Step 8: Bring Any Data into Power BI
You can query any endpoint, such as the Accounts list.
Go to Get data → Web again, this time using:
`{proxyBaseUrl}/api.xro/2.0/Accounts`
Authenticate with your Basic credentials (i.e., Username and Password).
Power Query will display your chart of accounts.
You can repeat this process with other endpoints (Profit and Loss, Invoices, etc.) by simply changing the path.
Conclusion
RequestRocket allows you to replace the authentication of any target system with the authentication method you prefer. In this tutorial, we've demonstrated how to directly consume the Xero API into Power BI without the need for expensive middleware. This approach is not limited to Xero; it applies to any OAuth 2.0 and 2.1 authenticated system, as well as any other system where you want to secure your credentials instead of exposing them in your code.



Comments