I currently have a Google analytics program to extract some analytic data from my website. Currently it sits on my local machine and is working fine. However I would like to move the program into our Oracle Cloud server, which hosts my web files. It's a linux based server with little to no browser support. I've tried running the program on the server but as usual, it prompts me to go to a website to authenticate Oauth..ect.ect
I've tried using a web browser on the server...does not work too well. I was wondering if anyone had solutions that'll allow me to use this application without having to use a web browser to authenticate.
EDIT: Having a hard time with the Service Acc thing
So... I have this in my current application to get the auth going...
/** Authorizes the installed application to access user's protected data. */
private static Credential authorize() throws Exception {
// load client secrets
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
JSON_FACTORY, new InputStreamReader(
extractanalyticsgoogleapi.class.getResourceAsStream("/client_secrets.json")));
if (clientSecrets.getDetails().getClientId().startsWith("Enter")
|| clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
System.out.println(
"Enter Client ID and Secret from https://code.google.com/apis/console/?api=analytics "
+ "into analytics-cmdline-sample/src/main/resources/client_secrets.json");
System.exit(1);
}
// set up authorization code flow
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
httpTransport, JSON_FACTORY, clientSecrets,
Collections.singleton(AnalyticsScopes.ANALYTICS_READONLY)).setDataStoreFactory(
dataStoreFactory).build();
// authorize
return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
}
And i'm not sure as to where i would put hte service Acc code into