Xero JDBC Connection issue
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>;
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.
Hope all this info makes sense. Please let me know if you have any questions.
ekviatkevich
Posted 1 year ago·Last reply 1 year ago
3 comments
DRay
·1 year agoHi ekviatkevich,
Have you talked with support about this issue? They will be able to review logs and help with this better than we can on the forum.
ekviatkevich
OP1 year agoHi DRay,
We actively discuss this question with support but don't have the solution yet, unfortunately
DRay
·1 year agoHello ekviatkevich,
Thank you for reaching out. I see your question hasn't gotten a response yet, so I'm asking internally to try and get you an answer.