cancel
Showing results for 
Search instead for 
Did you mean: 

Xero JDBC Connection issue

ekviatkevich
1 - New Member
1 - New Member

Hi,

 
Our team has an issue with Xero integration using JDBC driver.
 
Unfortunately, it seems like the connections for other services works but not for Xero. Let me give you as many details as I can.
First, we generate a connection string on our side to have the ability for users to connect to their accounts. Here is the structure of the connection string:
jdbc:xero:AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=<client_id>;OAuthClientSecret=<client_secret>;OAuthAccessToken=<access_token>;Scope="openid profile email accounting.transactions accounting.reports.read accounting.reports.tenninetynine.read accounting.journals.read accounting.settings accounting.contacts accounting.attachments accounting.budgets.read payroll.employees payroll.payruns payroll.payslip payroll.timesheets payroll.settings files assets
projects offline_access";OAuthRefreshToken=<refresh_token>;
OAuthSettingsLocation="%APPDATA%\CData\Xero Data Provider\OAuthSettings_<settings_location>.txt";OAuthExpiresIn=1800;OAuthTokenTimestamp=<timestamp>;
client_id - client id of our connection app;
client_secret - client secret of our connection app;
access_token - access token that the client received after implementing a connection;
refresh_token - refresh token that the client received after implementing a connection;
settings_location - special id that we generate for each integration. This id allow our clients to integrate their own integrations with the services;
timestamp - timestamp of received tokens;
 
This approach perfectly works for other integrations like Hubspot. But the main issue appeared because of Xero itself. For some reason they do not give us constant refresh tokens. According to their documentation, every time a refresh token is used, we need to receive a new refresh token. You can find this info here: https://developer.xero.com/documentation/guides/oauth2/token-types/#refresh-token
 
And seems like CData driver don't work in this part, because for the first build (when old refresh token is active) it's working but after initialization, when access_token expires (in 30 minutes after receiving access and refresh tokens) we not able to use it anymore because old token is not valid anymore and seems CData driver don't save new refresh token.
image (16).png
Hope all this info makes sense. Please let me know if you have any questions.
0 REPLIES 0