404 Resource Not Found: domain with Google Directory API

前端 未结 1 909
长情又很酷
长情又很酷 2021-01-15 14:00

I followed the quick start and am attempting to create a user using the google-api-ruby-client.

I\'ve set up access in the google api console. And I can get this to

相关标签:
1条回答
  • 2021-01-15 14:33

    After a bit of documentation reading, there were two things that I needed to fix.

    1. I hadn't set up the proper authorization for my test service account.

    You have to go to the Apps Console > Security > Advanced > Manage API client access and add the client url for your service account as well as any specific permissions that you want to add

    1. As seen in this question, it seems that you need to create a user object rather than just passing in parameters.

    Here's my updated code:

    # Authorization happens here ....
    
    api = client.discovered_api('admin', 'directory_v1')
    new_user = api.users.insert.request_schema.new(
        name: { familyName: 'Testy', givenName: 'Testerson' },
        primaryEmail: 'ttttesterson@<domain-redacted>.com',
        password: 'password123'
     )
    
      result = client.execute(
        api_method: api.users.insert,
        body_object: new_user
     )
    
    0 讨论(0)
提交回复
热议问题