I'm trying to authorize with google admin api and list mailing list users. I downloaded a key from api console and did:
require 'google/api_client'
client= Google::APIClient.new(application_name: "myapp", application_version: "0.1")
groups= client.discovered_api('admin', 'directory_v1')
key = Google::APIClient::PKCS12.load_key(Dir['*.p12'].first, 'notasecret')
client.authorization = Signet::OAuth2::Client.new(
token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
audience: 'https://accounts.google.com/o/oauth2/token',
scope: 'https://www.googleapis.com/auth/admin.directory.group.readonly',
issuer: '123asdf@developer.gserviceaccount.com',
signing_key: key)
client.authorization.fetch_access_token!
puts client.execute(api_method: groups.users.list, parameters: {}).body
I tried adding groupKey: "mygroup@googlegroups.com" I tried setting domain: "mysite.com" It always results in "insufficient permission"
What more do I have to do to to list users in a group?