When I try to authenticate with Google it throws an exception during authenticating (check service name).
I used the Google Java SDK for authenticating.
SpreadsheetService service = new SpreadsheetService("Print Google Spreadsheet Demo"); //this is my application name that i created in developer console
service.setUserCredentials(MY_GOOGLE_EMAIL_ADDRESS, GOOGLE_ACCOUNT_PASSWORD);
// Load sheet
URL metafeedUrl = new URL(SPREADSHEET_URL);
SpreadsheetEntry spreadsheet = service.getEntry(metafeedUrl, SpreadsheetEntry.class);
URL listFeedUrl = ((WorksheetEntry) spreadsheet.getWorksheets().get(0)).getListFeedUrl();
// Print entries
ListFeed feed = (ListFeed) service.getFeed(listFeedUrl, ListFeed.class);
The exception was thrown in the setUserCredentials()
method.
Exception:
com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:628)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:500)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)
Is there any configuration I missed before accessing the Google spreadsheet?