diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index c7c92f9514d..6a81b2e5975 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -124,7 +124,7 @@ class DolibarrApiAccess implements iAuthenticate $api_key = preg_replace('/^Bearer\s+/i', '', empty($headers['Authorization']) ? '' : $headers['Authorization']); }; - $api_key = dol_string_nounprintableascii($api_key); + $api_key = dol_string_nounprintableascii($api_key, 1); if (preg_match('/^dolcrypt:/i', $api_key)) { throw new RestException(503, 'Bad value for the API key. An API key should not start with dolcrypt:');