Templates Plugins Courses

Xero accounting plugin - expired token issue

Hi

I’m currently trying to get the Xero accounting plugin working but am having some issues. I did try to follow the documentation but that doesn’t seem to quite work or match your demo app in the way things are done.

I believe I have everything setup correctly for the actual integration as I’m able to connect and authenticate with Xero and get back the user info (id, email, give name, family name etc) ok.

But if I then try and make any calls (to get invoices for example) I get an error message ref the token already being expired as below.

What would you suggest as a way forward?

Thanks

Richard

Hi @richard8, thanks for your message.
I’ve passed described issue to the developer team for research. Once any results will become available, I will let you know asap.

Thank you for understanding :pray:

Regards,

1 Like

Thanks! I’d really appreciate a quick response (but fully understand everyone else probably wants the same!) as this issue is currently holding up a project :grimacing:

I’m sure it must be something I’m doing/not doing though as your demo (with different database architecture but the same stored info) still works ok.

Hi @richard8, sorry for no useful information shared so far :pray:
The developer team is checking internally what might be the reason for reported issue so I also wait for the results. In case any additional details will be required, I will let you know.

Regards,

Thanks! As your demo App is working I think it must be something I am doing even though I thought it was setup correctly and is authenticating initially. It probably needs one of your team to look at my App to see the issue.

Hi @richard8, thanks for your reply.
Please add our Support Team email to the list of collaborators to your application and provide me (in a DM) a link to your application, with an indication on which page the case is set and how to get the error as mentioned above. Please also check if within your Xero account are enough dummy data to be used for data calls (for example - to display Invoices, at least a few of them should be created).

To add our Support Team as a collaborator, you need to do the following steps in the Bubble Editor:

Settings > Collaboration > Add email support@zeroqode.com

Note: avoid the warning message regarding the plan, as we are an agency and you can easily add us to your collaborators.

Looking forward to your reply.

Regards,

Thanks @Serg , I’ve just DM’d you with the info and demo video, and added you as a collaborator.

Hi @richard8, thanks for your patience and provided access.

Our developer team checked your setup and would like to share the following feedback:

Within your app, when you want to refresh the token, the workflow sends a list of refresh tokens. In our demo, we send Refresh Token from the first element was found. In your case, the user sends a list of refresh tokens from all Users.

There are 2 ways to fix it:

  1. After authentication on Xero, save the email from Xero on state.


    In this case, you can do “Search for Users” with email constraint and get “:first items’s xero refresh token” from the obtained user in the “Refresh Token” action.

  2. After authentication on Xero, you can add the “Log in” action with an email obtained from Xero authentication. In this case, you can use “Current user xero refresh token” in “Refresh Token” action.

Hope this hint will help. If there will be anything else that I can help with about our plugin, please let me know.

Regards,

Hi

Thanks for looking into this for me. Unfortunately, the multiple token issue was created when I modified the existing issue whilst clutching at straws! I’ve put the code back to how it was originally which is the issue with an expired token (screenshot of error message below).

If I understand it correctly after a quick look, the login suggestion won’t work for me either as the email address of the Bubble user may not match the email address of the Xero user (in my test case, it definitely doesn’t).

Hi @richard8, thanks for your reply.

We’ve asked the developer team to check this moment once again. As soon as there will be any related feedback, I will let you know :pray:

Regards,

@richard8
As far as we understood, the problem is in static credentials that the user sends in the call. In our demo, we are using dynamic values.

It is necessary to use the last obtained access token from “Get Xero Token From URL Oauth 2.0” or from “Refresh Token” actions.


We recommend saving the access token in the database for the Current User, then getting it.

For example, in workflow on page load, add Login to bubble action (after step 3, getting the mail from Xero).

Regards,