I'm using this example from Docs <LINK> the only thing i changed was the read scope only for a scope that is allowed to create a user
to list
$optParams = array(
'customer' => 'my_customer',
'maxResults' => 10,
'orderBy' => 'email',
);
$results = $service->users->listUsers($optParams);
if (count($results->getUsers()) == 0) {
print "No users found.\n";
} else {
print "Users:\n";
foreach ($results->getUsers() as $user) {
printf("%s (%s)\n", $user->getPrimaryEmail(),
$user->getName()->getFullName());
}
}
i'm trying to create the user like this:
$setEmails = array("familyName"=>"Teste", "givenName"=>"Teste", "password"=>"Zr>bXm3DBfjijwjd3a","primaryEmail"=>"teste@dominio.br");
$user->setEmails($setEmails);
$results = $service->users->insert($user);
$results = $service->users->listUsers($optParams);
print_r($results);
this is the error
Fatal error: Uncaught Google_Service_Exception: {
"error": {
"code": 400,
"message": "Invalid Input: primary_user_email",
"errors": [
{
"message": "Invalid Input: primary_user_email",
"domain": "global",
"reason": "invalid"
}
]
}
}
help me please!