I have a service account created and given DwD with necessary scopes.
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/cloudplatformprojects.read-only
https://www.googleapis.com/auth/iam
https://www.googleapis.com/auth/apps.groups.settings
I am trying to access Google API services of CloudResourceManager API , IAM API and Admin SDK API(through admin impersonation), in the same Python program. I am getting an Unauthorized_Client error when I use Admin service.
('unauthorized_client: Client is unauthorized to retrieve access tokens using this
method.', u'{"error" : "unauthorized_client", "error_description" : "Client is
unauthorized to retrieve access tokens using this method."}')
However, If I use only Admin API without other APIs, it works strangely. Is it something to do with the scopes overlap? Thanks in Advance.
@DalmTo Tried in these two ways for authentication 1)
from google.oauth2 import service_account
credentials = Service_account.Credentials.from_service_account_file("keys.json", scopes=scopes)
from oauth2client.service_account import ServiceAccountCredentials
credentials = ServiceAccountCredentials.from_json_keyfile_name("Keys.json", scopes=scopes)