You can use OAuth2 in an offline (batch) environment. See this page for more information:
https://developers.google.com/identity/protocols/OAuth2InstalledApp - Eric On Sunday, July 12, 2015 at 7:28:21 PM UTC+9, Kazuki wrote: > > Hi, > > I made a batch program which get some spread sheets and update them with > Client Login method. > But, it is no longer work now because authentication error happen. > > I want to execute a SpreadSheets batch program with cron. > So, I tried to read and to migrate to OAuth2.0 method. > However, I couldn't understand how I use OAuth2.0 as a batch in Java code. > > Please tell me a solution of this problem. > Thank you. > > > // current java source code > public static SpreadsheetService getService() { > SpreadsheetService service = new > SpreadsheetService("MySpreadsheetIntegration"); > service.setProtocolVersion(SpreadsheetService.Versions.V3); > > // get Username and Password from JSON file > String username = getValueJsonFile("Username", JSON_FILE); > String password = getValueJsonFile("Password", JSON_FILE); > > try { > service.setUserCredentials(username, password); > } catch (AuthenticationException e) { > e.printStackTrace(); > System.out.println("Error code: " + e.getCodeName()); > log.error(getMessage("WRONG_USER_PASS")); > } > return service; > } > -- You received this message because you are subscribed to the Google Groups "Google Spreadsheets API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
