0

I got the super admin privileges for to my Google Account.

I need to get the list of all the chrome devices through an API.

I did enable Google Admin SDK but still facing some issues. I copied the exact python script from Python Quickstart for checking but still getting error as

"googleapiclient.errors.HttpError: https://www.googleapis.com/admin/directory/v1/users?customer=my_customer&orderBy=email&alt=json&maxResults=10 returned "Insufficient Permission">"

When checked on Admin SDK API dashboard I can see 4xx errors for every call made from my python script.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Ashwin
  • 2,875
  • 1
  • 13
  • 21

2 Answers2

0

When you run the sample you need to make sure that this step

The sample will attempt to open a new window or tab in your default browser. If this fails, copy the URL from the console and manually open it in your browser. If you are not already logged into your Google account, you will be prompted to log in. If you are logged into multiple Google accounts, you will be asked to select one account to use for the authorization.

Is done from the Google account which has access to your admin account. The user you are logged in with now does not have access.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • I did authorise when it prompted me to on the browser, that when it created a file under ".credentials/admin-directory_v1-python-quickstart.json" which had the details of clientid, access_token, client_secret and stuff like that. – Ashwin Apr 18 '17 at 08:01
  • The user must be one that has access to admin directory. It doesn't appear to. Try again in the browser window with the correct user. Client id and client secrete are just the project on google developer console and do not grant you access to admin directory. Its the user authenticating via the browser that will give you access. – Linda Lawton - DaImTo Apr 18 '17 at 08:04
  • The user has got the access to admin directory as in the UI i can see all the chrome devices listed under my account. Also the user is the same which has authorized the python code. – Ashwin Apr 18 '17 at 09:10
0

I managed to get Super Admin access of Google account and then grant access to my project for different scopes. The docs/ references are so confusing hence it took a while for me to figure it out. So under the admin console, we have to get into Security >> Advanced Settings >> Manage API Client Access(under Authentication) and then add the client name and the scopes(multiple scopes separated by commas) for which we need access. Client name is the client-id which we can get from the client-secretxxxxx.json file(downloaded while creating the oauth id). NOTE :- You do NOT need super admin access it is just that I was new and the guy who gave me the initial access wasn't sure what has to be enabled across. Also couldn't post as a comment due to the limitation of characters.

Ashwin
  • 2,875
  • 1
  • 13
  • 21