@Override
public AuthorizationCodeFlow getAuthorizationCodeFlow() {
Optional<String> businessResource = getOneDriveForBusinessResource();
if (businessResource.isPresent()) {
String clientId = getClientId();
String clientSecret = getClientSecret();
String authorizationServerURL = getAuthorizationServerURL();
Credential.AccessMethod method = BearerToken.authorizationHeaderAccessMethod();
GenericUrl tokenServerUrl = new GenericUrl(getTokenServerURL());
HttpExecuteInterceptor clientAuthentication = new ClientParametersAuthentication(clientId, clientSecret);
return new OneDriveAuthorizationCodeFlow.Builder(method, HTTP_TRANSPORT, JSON_FACTORY, tokenServerUrl,
clientAuthentication, clientId, authorizationServerURL).setBusinessResource(businessResource.get())
.setScopes(getScopes())
.setCredentialDataStore(
getCredentialDataStore())
.build();
}
return super.getAuthorizationCodeFlow();
}