Xero-Java
Xero-Java copied to clipboard
Upgrade google-api-client version from 1.23.0 to 1.31.4
Is your feature request related to a problem? Please describe. There is nothing broken in the current version 1.23.0 dependency that is used but it was released Oct 2017.
Documentation around this version of the SDK are being replaced with newer information around how to build the authentication flow. Classes used in this version have been deprecated in favor of improved classes.
Describe the solution you'd like Upgrade to version 1.31.4 which was released April 2021.
This would be a breaking change and major versioning would be required. Recommend bundling with other breaking feature improvements.
Additional context All methods for making API calls are unchanged by moving to version 1.31.4.
Two methods will need to be updated they are authorization code flow and authorization code token response
Authorization flow for 1.23.0
DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory();
AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(),
HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL),
new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL)
.setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build();
String url = flow.newAuthorizationUrl()
.setClientId(clientId)
.setScopes(scopeList)
.setState(secretState)
.setRedirectUri(redirectURI).build();
Authorization flow for 1.31.4
String url = new AuthorizationRequestUrl(AUTHORIZATION_SERVER_URL, clientId, Arrays.asList("code"))
.setState("xyz")
.setRedirectUri(redirectURI)
.setScopes(scopeList)
.build();
response.sendRedirect(url);
Authorization Code Token Request 1.23.0
DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory();
AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(),
HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL),
new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL)
.setScopes(scopeList)
.setDataStoreFactory(DATA_STORE_FACTORY)
.build();
TokenResponse tokenResponse = flow.newTokenRequest(authResponseCode)
.setRedirectUri(redirectURI)
.execute();
Authorization Code Token Request 1.31.4
TokenResponse tokenResponse = new AuthorizationCodeTokenRequest(new NetHttpTransport(), new GsonFactory(),
new GenericUrl(TOKEN_SERVER_URL), clientId)
.setRedirectUri(redirectURI)
.setCode(authResponseCode)
.setScopes(scopeList)
.setGrantType("authorization_code")
.setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret))
.execute();
Another additional benefit to upgrading is the current version does not have an httpclient that support the PATCH method. This is used by the projects API.
Closing this since we have upgraded to google-api-client 1.34.0