Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Partner Program >

The access token has expired xero

Started by Johny Motorhead -   in Partner Program

Hi everyone!

We develop Partner API Web application. We have an issue "The access token has expired xero". What to do in this case? When we try to renew session, using RenewAccessToken() we get error "The token repository doesn't have a current access token". In this case we try to add to Token Repository request/access tokens from DB and then RenewAccessToken(), but we get error "Token XXX does not match an expected REQUEST token"

We'll be glad for any help or advise!

Okay, we have found out, that we need to renew access token via Xero API. how can we do that?

We really need help.

Thanks in advance,

Johny Motorhead  

I have also run into this problem with our ASP.NET MVC application.

I'm storing the access token in our DB and the request token in the session. I thought that I was unable to renew the access token because the session had expired and the request token was gone, however I tried persisting the request token to the DB and then got the "Token XXX does not match an expected REQUEST token" error.

What's the best/recommended practice for handling expired access tokens in a Partner application? Do we need to hang on to the request token?


Chris Jacques  

Getting this error as well occasionally.
Is there a way to make the public connection longer than 30 minutes?

When I get that error I can just attempt the API again by refreshing and it seems to work then. What would cause this?

Creative Family  

Anyone get a solution to this yet?

There are so many partners out there that seem to have this working. It would be nice if they could share their knowledge with the rest of us. :S

Marcel Marais  

I am using also partner api. Found same issue.
I am storing RequestToken object in DB after converting via JSON Serialization, and same thing for AccessToken. Now for during RenewAccess Token I am using this RequestToken But it seems "Token XXXXXXXXXXXXX does not match an expected ACCESS token xero" .

Please help me into this.
Thanks In Advance.

Ankur D  

We are also facing the same issue. It will be great if anyone can help.

Nilesh Garg  

Any solution so far?

Duncan Grant  

has anyone solved this issue?

Duncan Grant  

Two years on and this is still an issue for us. Bump!

Chris Jacques  

I am happy to provide my own code and highlight the piece of it.

Duncan Grant  

Hi @Chris, does it mean there is no such way to renew the token and function the xero api without sending the user on xero page again for the authentication ?

Duncan Grant  

The access token has expired

Resolution: For Public applications, authentication sessions last 30 minutes. The user will need to re-authenticate the connection,

"The user will need to re-authenticate the connection"
Can you tell exactly what needs to be done in a php code?
We decided to try xero in a hope that xero API more developer friendly than QuickBooks. And now we see that simple questions are not answered for TWO YEARS.. not good..

vitaly goji  

authentication sessions expires after 30 minutes in Partner App. This is not good.
Any help , I don't think that I can get any reply from this XERO community.

Muhammad Fayyaz  


How to get RenewAccessToken working?

Brian Smith