0

From the Google Documentation I understood that the email quota is not used anymore. I'm OK with that, but the question is how to provide credentials for user creation in Google Apps. Currently I'm doing it like that:

GoogleCredential credential = new GoogleCredential.Builder()
                  .setTransport(transport)
                  .setJsonFactory(jsonFactory)
                  .setClientSecrets(adminid, adminpwd)
                  .build();

But I'm receiving 401 Unauthorized.

Andy
  • 2,374
  • 3
  • 17
  • 20

1 Answers1

1

Where's your access token? Try

credential.refreshToken();
accessToken = credential.getAccessToken();
credential.setAccessToken(accessToken);

You'll probably want to retrieve a refresh token too. It may be cleaner to build your credentials with the tokens. Refer to the docs here or here.

Andy
  • 2,374
  • 3
  • 17
  • 20
  • Thank you for the answer. Unfortunately I don't have token, because I want just to manage (create user account, remove, update etc.) users in google apps. I don’t have any programs created so I don’t have credential settings. I found something suitable under this topic: Google App Engine identity, but the information only brings more questions instead providing an answers: - Where I should put my credentials (user name, password) - Why the runtime libs are not added to the google client library (i.e. com/google/appengine/api/appidentity/AppIdentityServiceFactory) – IDM Admin Apr 20 '15 at 11:36