使用Google SpreadSheet API时出现身份validation错误

我有下课

import java.net.URL; import com.google.gdata.client.spreadsheet.CellQuery; import com.google.gdata.client.spreadsheet.SpreadsheetService; import com.google.gdata.data.spreadsheet.CellEntry; import com.google.gdata.data.spreadsheet.CellFeed; import com.google.gdata.data.spreadsheet.SpreadsheetEntry; import com.google.gdata.data.spreadsheet.WorksheetEntry; public class ExpressionExample { public static final String GOOGLE_ACCOUNT_USERNAME = "********"; public static final String GOOGLE_ACCOUNT_PASSWORD = "*********"; private static URL cellFeedUrl; public static final String SPREADSHEET_URL = "https://spreadsheets.google.com/feeds/spreadsheets/1QWX-zOkBe36M7oC9sn6z8ZuccGt7Wg-IFwtynn379kM"; public static void main(String[] args) throws Exception { SpreadsheetService service = new SpreadsheetService( ""); service.setUserCredentials(GOOGLE_ACCOUNT_USERNAME, GOOGLE_ACCOUNT_PASSWORD); URL metafeedUrl = new URL(SPREADSHEET_URL); SpreadsheetEntry spreadsheet = service.getEntry(metafeedUrl, SpreadsheetEntry.class); WorksheetEntry sheet = ((WorksheetEntry) spreadsheet.getWorksheets() .get(0)); cellFeedUrl = spreadsheet.getWorksheets().get(0).getCellFeedUrl(); CellEntry cellA1 = new CellEntry(1, 1, "3"); CellEntry cellB1 = new CellEntry(1, 2, "high mech"); String line = "=IF(A1<5,IF(B1={\"high mech\",\"low mech\",\"mid mech\"},10,IF(B1=\"electronic\",20,0)),IF(A1>=5,IF(B1=\"electronic\",40,0),0)) "; CellEntry cellc1 = new CellEntry(1, 3, line); service.insert(cellFeedUrl, cellA1); service.insert(cellFeedUrl, cellB1); service.insert(cellFeedUrl, cellc1); ExpressionExample e = new ExpressionExample(); e.printCell(cellA1); e.printCell(cellB1); e.printCell(cellc1); CellQuery query = new CellQuery(cellFeedUrl); query.setMinimumRow(1); query.setMaximumRow(1); query.setMinimumCol(3); query.setMaximumCol(3); CellFeed feed = service.query(query, CellFeed.class); System.out.println(feed.getEntries().indexOf(cellc1)); for (CellEntry entry : feed.getEntries()) { e.printCell(entry); } } public void printCell(CellEntry cell) { //String shortId = cell.getId().substring(cell.getId().lastIndexOf('/') + 1); System.out.println(" -- Cell("+ "/" + ") formula(" + cell.getCell().getInputValue() + ") numeric(" + cell.getCell().getNumericValue() + ") value(" + cell.getCell().getValue() + ")"); } } 

当我尝试login凭据,谷歌让我login。 但是当我使用这个程序时,我得到了Authenticationexception。

前一天工作正常,但突然停止工作。

任何帮助将不胜感激。