Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Partner Program >

Renew Token Partner Application

Started by Andy Nguyen -   in Partner Program

I am using partner application to retrieve third party reports.
the problem is token will be expired in 30 mins, I have session expired in 2029, how can I use that for renew token. Is there any manual way to do that? I heard somewhere say Xero automatic refresh the token for partner application, but I couldn't see how it works.
what I have done:
1. Create a partner authenticator
auth = new PartnerMvcAuthenticator(
_configService.GetSetting(SETTING_ENDPOINTURL),
_configService.GetSetting(SETTING_OAUTH),
callbackUrl,
new SQLTokenStore(_ctxFactory, _dateTimeService, SQLTokenStore.TokenType.Auth),
singingCert,
entrustCert,
Consumer,
new SQLTokenStore(_ctxFactory, _dateTimeService, SQLTokenStore.TokenType.Request));
my SQLTokenStore inherited ITokenStore
2. Create a core api using the at authenticator
_xeroCoreApi = new XeroCoreApi(_configService.GetSetting(SETTING_ENDPOINTURL),
auth,
Consumer,
user,
new DefaultMapper(),
new DefaultMapper());
3. call api:
api.BalanceSheet(date: todate);

when token expired it is not automatic call Delete and Add new token in SQLtokenstore.
Can anyone explain how it works, or what is wrong with my implement?
I am wondering my request store is not correct?

And I have one more question, is partner api call free or need to pay?

Thank you,


Hi Andy, 30minutes is the default expiration time of public tokens. Partner apps get the ability to use a refresh token with oAuth 1.0

If you are not a verified partner; you may achieve what you are looking for with the oAuth 2.0 beta integration which allows tokens to be refreshed before becoming a partner app.

Partner API access requires vetting by XERO and explicit approval; if you do not have this you are using the public connection.
 

Jonathan Mifsud