Skip to content
Advertisement

Change password with Google API Directory with special characters

I am already using Google API Directory to change user’s password but one user has put an “ñ” in his password. When he tries to log in, he gets an error saying that the password is not correct. The letter “ñ” is an extended ASCII character.

The API Directory documentation says:

A password can contain any combination of ASCII characters

My question is: a password can contain extended ASCII characters or only the basic ones?

To encode the password I use this code (the password has utf-8 encoding):

$user_obj = new Google_Service_Directory_User();
$service = new Google_Service_Directory($client);

//Asci conversion
$dades["password"] = mb_convert_encoding($dades["password"], "ASCII", mb_detect_encoding($dades["password"]));
$user_obj->setHashFunction("SHA-1");        //SHA1 hash
$user_obj->setPassword(hash("sha1", $dades["password"]));

//Execute
try{
    $service->users->update($dades["emailg"],$user_obj);
                
} catch (Exception $e) { 
    $errors = $e->getMessage();
}

Advertisement

Answer

Answer:

No, extended character sets are disallowed.

More Information:

From the Google Account Help article on creating passwords (emphasis my own):

Meet password requirements

Create your password using 12 characters or more. It can be any combination of letters, numbers, and symbols (ASCII-standard characters only). Accents and accented characters aren’t supported.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement