Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin-sdk Error 400: Bad Request, badRequest #10

Closed
erkolson opened this issue Sep 19, 2018 · 5 comments
Closed

Admin-sdk Error 400: Bad Request, badRequest #10

erkolson opened this issue Sep 19, 2018 · 5 comments
Assignees

Comments

@erkolson
Copy link

Expected Behavior

I'm trying to use this example:
https://developers.google.com/admin-sdk/directory/v1/quickstart/go
I expect to see a list of users names and email addresses from my domain

Actual Behavior

I get an error from this line:
https://github.com/gsuitedevs/go-samples/blob/master/admin_sdk/directory/quickstart.go#L104

Unable to retrieve users in domain: googleapi: Error 400: Bad Request, badRequest

I am using ... .Customer("<my-domain>") ..., there are several users in the org that have email addresses in that domain.

Steps to Reproduce the Problem

  1. Followed the G Suite wide delegation guide to get client credentials/private key:
    https://developers.google.com/admin-sdk/directory/v1/guides/delegation
  2. Added the service requests to get domain users
  3. Compile succeeds and run => error.

Specifications

  • go1.10.2
  • macOs 10.13.6
@erickoledadevrel erickoledadevrel self-assigned this Sep 19, 2018
@erickoledadevrel
Copy link

The quickstart uses user (3-legged) OAuth, not service accounts. Have you gotten that to work? When you use the special value "my_customer" for the customer ID, does that work?

@erkolson
Copy link
Author

erkolson commented Sep 20, 2018

Thanks! I also get the same error when I used OAuth. When I paste the code from the web browser back in the terminal, I see this:

Saving credential file to: token.json
2018/09/19 13:25:29 Unable to retrieve users in domain: googleapi: Error 400: Bad Request, badRequest

When I use the "my_customer" value it says this:

Unable to retrieve users in domain: googleapi: Error 404: Domain not found., notFound

What is my_customer? I've read a good bit of the documentation and don't really understand how customers come into this.

@erickoledadevrel
Copy link

The value my_customer is a shortcut for referring to the G Suite organization you are a part of. Is the authorized user part of a G Suite domain, or is it a gmail.com account?

@erickoledadevrel
Copy link

Closing due to inactivity.

@tomscript
Copy link

for future folks who may see this, i hit this when querying the directory API trying list users. however the list users api requires a domain string be set

unfortunately the err doesn't tell you the field you're missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants