I'm trying to use Go and the Google Admin Directory API to manage some Gsuite user attributes, specifically passwords and changePasswordAtNextLogin. I can build my user and send it to update
srv := client()
user := admin.User{
ChangePasswordAtNextLogin: forceReset,
HashFunction: "MD5",
Password: fmt.Sprintf("%x", md5.Sum([]byte(newPassword))),
}
_, err := srv.Users.Update(email, &user).Do()
and the password will be updated successfully. If forceRest
is true
then it will set the flag for the user, but if it's false
it won't remove the flag! Is this a bug in the Go API library, or am I doing something wrong?
I tried adding ForceSendFields: []string{"ChangePasswordAtNextLogin"}
to the User
struct and that didn't help.