The Auth instance.
The password to validate.
Validates the password against the password policy configured for the project or tenant.
The Auth instance.
The password to validate.
If no tenant ID is set on the Auth instance, then this method will use the password
policy configured for the project. Otherwise, this method will use the policy configured
for the tenant. If a password policy has not been configured, then the default policy
configured for all projects will be used.
If an auth flow fails because a submitted password does not meet the password policy requirements and this method has previously been called, then this method will use the most recent policy available when called again.
When using this method, ensure you have the Identity Toolkit enabled on the Google Cloud Platform with the API Key for your application permitted to use it.
import { getAuth, validatePassword } from "firebase/auth";
const status = await validatePassword(getAuth(), passwordFromUser);
if (!status.isValid) {
// Password could not be validated. Use the status to show what
// requirements are met and which are missing.
// If a criterion is undefined, it is not required by policy. If the
// criterion is defined but false, it is required but not fulfilled by
// the given password. For example:
const needsLowerCase = status.containsLowercaseLetter !== true;
}
Validates the password against the password policy configured for the project or tenant.