Issue setting up XERO API with Bubble App

Hi Bubblers,

I am working on a Web App in which I am allowing users to connect their XERO account so that their Invoices can be fetched from Company/Organization that they have created in XERO.

For this I created a XERO account and could see the Demo Organization pre-created in there. I also logged on to the XERO Developer account with the same account, created an App there and got the Client ID and Secret from there.

I redirected users to this URL for OAuth process completion:
Screenshot 2023-11-17 000834

A button click on my page redirects users to XERO where they are asked to login to their XERO account, select an organization and returns with CODE to the redirect_uri.

In the next step, I try to utilize this CODE to get access token. This is the complete request that I am using:

POST https://identity.xero.com/connect/token
Authorization: Basic Base64encoded(ClientID:Secret)
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=CODE
&redirect_uri=My_REDIRECT_URI

Everytime I run this request via Bubble’s API connector, I get this error:

I don’t know what the issue is. I have generated CODE multiple times. The Client ID and Secret that I use for encoding are exactly the same as shown in the app that I created on XERO Development portal. I have used multiple sources for base 64 endoing and matched them all so I don’t think there’s any issue in encoding as well.

Whoever has had a chance on XERO-Bubble integration, your help in this regard would be highly appreciated. Thanks

1 Like

@Talha54 have you seen this?

1 Like

Hi @adam30
I saw your post regarding setting up XERO Oauth 2.0 setup. I am having issue using the Oauth code that I received to exchange token. Can you please go through my post above and suggest what am I doing wrong?
Thanks in advance

Thanks @S2294

I have completed the Oauth phase but struggling to use the Oauth code to exchange tokens. Getting an error there?

I do it a bit differently now. See the attached screenshot for how I set it up. Let me know if that solves your problem :slight_smile:

@adam30 Thanks for your valuable suggestion.

Seems like you have Authentication setup as “HTTP Basic Auth” and using Username and Password.

Can you tell me what username and password would I have to use if I also use this setup? I tried putting my XERO developer account credentials Username and Password and setup the way you did in the above screenshot; I still get an error.

Screenshot 2023-11-20 204212

it should be your api key and secret

That error looks like you aren’t providing the correct client id

Thanks @adam30 for your responses.

I was able to fix this issue later on.

How did you manage to fix the issue? I’m currently in the same boat