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();