Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Token rejected - Does not match an expected access token/Token has expired

Started by Code Creator -   in API Authentication


I'm currently having some issues when trying to implement a partner application.
I currently have everything working in my local development environment and I can refresh the token no problem. However, as soon as I publish to our staging environment, stuff acts weird.
Now I can sporadically get the token to work. But most of the time I get one of two errors.
Either 1: "Token rejected - Does not match an expected access token", which would indicate that it is not the correct access token that I'm trying to refresh.
Problem is, if I try and refresh that exact same access token in my local environment, everything works as expected.

Error 2: "Token expired - The access token has expired". This does not make sense as I'm checking to see if the access token has expired before making any calls to the api, so that I can refresh it if that is the case.

I'm using the Xero.API.SDK NuGet package to connect to Xero.

Any help would be greatly appreciated.