0

I used JAVA Quickstart example and modified it a little to add users to the group. I have 2 questions here

i) I have created OAuth 2 client_secret and Service Account credentials. I do not know the difference between these two. I read service Account is used to get information from my application(but didn't understand what it meant). Can someone explain me these two with examples. And which will be useful in my scenario of adding users to group. I have used OAuth client_secret and it worked.

ii) I have added user(email id) as member in a group using below stmt, when I give same user it adds again(I know it is just an insert function and doesn't check the group). How can I avoid these? I do not want duplicates, the user list gets updated daily and I just need to add the new users.

 service.members().insert(GroupId,newMember).execute();
Shik9
  • 15
  • 4
  • Did you check the Using OAuth 2.0 for [Server to Server Applications](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount) and [Understanding Service Accounts](https://cloud.google.com/iam/docs/understanding-service-accounts)? – ReyAnthonyRenacia Feb 27 '18 at 15:07
  • Thank you for the links. It made little clear. So it is upto the user to decide to use OAuth secret key of user or service account to access resources. Is my understanding right? And I can do my above task using any one of these? – Shik9 Feb 28 '18 at 19:27

0 Answers0