Accessing Google Contacts Api via OAuth 2.0 and private key aka Service Account
I am currently implementing access to Google Contacts via OAuth 2.0 and a so called Service Account. The service account is generated for an ordinary user like "My.Name@gmail.com". The code to generate the OAuth 2.0 credentials is: public static GoogleCredential getCredentials() throws GeneralSecurityException, IOException { GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(SingleUserCredentials.SERVICE_ACCOUNT_EMAIL) .setServiceAccountScopes("https://www.google.com/m8/feeds")