0

Is there any way to create user in google admin console without password? Users can create a new password with First Time Login I am using google admin sdk API with service account Bearer token to create user.

Url: https://admin.googleapis.com/admin/directory/v1/users

Payload: {
   "primaryEmail":"sampleuser@orgdomain.com",
   "name":{
      "givenName":"Test",
      "familyName":"User"
   },
   "suspended":false,
   "password":"Password1234",
   "changePasswordAtNextLogin":true,
   "ipWhitelisted":false,
   "emails":[
      {
         "address":"sampleuser@orgdomain.com",
         "type":"home",
         "customType":"",
         "primary":true
      }
   ]
}

The API is failing without the password field. Is there any way to enable or disable any configuration in admin console to achieve same.? Related Answers will be helpful. Thanks

Amit Swain
  • 301
  • 1
  • 6
  • 11

1 Answers1

1

You can't create a user without a password within the API.

The method users.insert requires an instance of the Resource: users on the request body and the Resource: Users states that the password is required when creating a new user:

password:

Stores the password for the user account. The user's password value is required when creating a user account. It's optional when updating a user and should only be provided if the user is updating their account password. The password value is never returned in the API's response body.

A password can contain any combination of ASCII characters, and must be between 8-100 characters.

We recommend sending the password parameter as a hexadecimal-encoded hash value and setting hashFunction accordingly. If hashFunction is specified, the password must be a valid hash key.

Kessy
  • 1,894
  • 1
  • 8
  • 15