Interface Passwords

  • All Implemented Interfaces:

    
    public interface Passwords
    
                        

    The Passwords interface provides methods for authenticating, creating, resetting, and performing strength checks of passwords.

    Stytch supports creating, storing, and authenticating passwords, as well as support for account recovery (password reset) and account deduplication with passwordless login methods.

    Our implementation of passwords has built-in breach detection powered by HaveIBeenPwned on both sign-up and login, to prevent the use of compromised credentials and uses configurable strength requirements (either Dropbox’s zxcvbn or adjustable LUDS) to guide members towards creating passwords that are easy for humans to remember but difficult for computers to crack.

    • Constructor Detail

    • Method Detail

      • resetBySession

         abstract StytchResult<IAuthData> resetBySession(Passwords.ResetBySessionParameters parameters)

        Reset the user’s password and authenticate them. This endpoint checks that the session is valid and hasn’t expired or been revoked. The provided password needs to meet our password strength requirements, which can be checked in advance with the password strength endpoint. If the password and accompanying parameters are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset a user's password
        Returns:

        AuthResponse

      • resetBySession

         abstract Unit resetBySession(Passwords.ResetBySessionParameters parameters, Function1<StytchResult<IAuthData>, Unit> callback)

        Reset the user’s password and authenticate them. This endpoint checks that the session is valid and hasn’t expired or been revoked. The provided password needs to meet our password strength requirements, which can be checked in advance with the password strength endpoint. If the password and accompanying parameters are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset a user's password
        callback - a callback that receives an AuthResponse
      • resetBySessionCompletable

         abstract CompletableFuture<StytchResult<IAuthData>> resetBySessionCompletable(Passwords.ResetBySessionParameters parameters)

        Reset the user’s password and authenticate them. This endpoint checks that the session is valid and hasn’t expired or been revoked. The provided password needs to meet our password strength requirements, which can be checked in advance with the password strength endpoint. If the password and accompanying parameters are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset a user's password
        Returns:

        AuthResponse

      • authenticate

         abstract StytchResult<IAuthData> authenticate(Passwords.AuthParameters parameters)

        Authenticate a user with their email address and password. This endpoint verifies that the user has a password currently set, and that the entered password is correct.

        There are two instances where the endpoint will return a reset_password error even if they enter their previous password:

        • The member's credentials appeared in the HaveIBeenPwned dataset. We force a password reset to ensure that the member is the legitimate owner of the email address, and not a malicious actor abusing the compromised credentials.

        • The member used email based authentication (e.g. Magic Links, Google OAuth) for the first time, and had not previously verified their email address for password based login. We force a password reset in this instance in order to safely deduplicate the account by email address, without introducing the risk of a pre-hijack account-takeover attack.

        Parameters:
        parameters - required to authenticate
        Returns:

        AuthResponse

      • authenticate

         abstract Unit authenticate(Passwords.AuthParameters parameters, Function1<StytchResult<IAuthData>, Unit> callback)

        Authenticate a user with their email address and password. This endpoint verifies that the user has a password currently set, and that the entered password is correct.

        Parameters:
        parameters - required to authenticate
        callback - a callback that receives an AuthResponse
      • authenticateCompletable

         abstract CompletableFuture<StytchResult<IAuthData>> authenticateCompletable(Passwords.AuthParameters parameters)

        Authenticate a user with their email address and password. This endpoint verifies that the user has a password currently set, and that the entered password is correct.

        There are two instances where the endpoint will return a reset_password error even if they enter their previous password:

        • The member's credentials appeared in the HaveIBeenPwned dataset. We force a password reset to ensure that the member is the legitimate owner of the email address, and not a malicious actor abusing the compromised credentials.

        • The member used email based authentication (e.g. Magic Links, Google OAuth) for the first time, and had not previously verified their email address for password based login. We force a password reset in this instance in order to safely deduplicate the account by email address, without introducing the risk of a pre-hijack account-takeover attack.

        Parameters:
        parameters - required to authenticate
        Returns:

        AuthResponse

      • create

         abstract StytchResult<CreateResponse> create(Passwords.CreateParameters parameters)

        Create a new user with a password and an authenticated session for the user if requested. If a user with this email already exists in the project, this method will return an error.

        Parameters:
        parameters - required to create an account
        Returns:

        PasswordsCreateResponse

      • create

         abstract Unit create(Passwords.CreateParameters parameters, Function1<StytchResult<CreateResponse>, Unit> callback)

        Create a new user with a password and an authenticated session for the user if requested. If a user with this email already exists in the project, this method will return an error.

        Parameters:
        parameters - required to create an account
        callback - a callback that receives a PasswordsCreateResponse
      • createCompletable

         abstract CompletableFuture<StytchResult<CreateResponse>> createCompletable(Passwords.CreateParameters parameters)

        Create a new user with a password and an authenticated session for the user if requested. If a user with this email already exists in the project, this method will return an error.

        Parameters:
        parameters - required to create an account
        Returns:

        PasswordsCreateResponse

      • resetByEmailStart

         abstract StytchResult<BasicData> resetByEmailStart(Passwords.ResetByEmailStartParameters parameters)

        Initiates a password reset for the email address provided. This will trigger an email to be sent to the address, containing a magic link that will allow them to set a new password and authenticate.

        Parameters:
        parameters - required to reset an account password
        Returns:

        BaseResponse

      • resetByEmailStart

         abstract Unit resetByEmailStart(Passwords.ResetByEmailStartParameters parameters, Function1<StytchResult<BasicData>, Unit> callback)

        Initiates a password reset for the email address provided. This will trigger an email to be sent to the address, containing a magic link that will allow them to set a new password and authenticate.

        Parameters:
        parameters - required to reset an account password
        callback - a callback that receives a BaseResponse
      • resetByEmail

         abstract StytchResult<IAuthData> resetByEmail(Passwords.ResetByEmailParameters parameters)

        Reset the user’s password and authenticate them. This endpoint checks that the magic link token is valid, hasn’t expired, or already been used. The provided password needs to meet our password strength requirements, which can be checked in advance with the strengthCheck method. If the token and password are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset an account password
        Returns:

        AuthResponse

      • resetByEmail

         abstract Unit resetByEmail(Passwords.ResetByEmailParameters parameters, Function1<StytchResult<IAuthData>, Unit> callback)

        Reset the user’s password and authenticate them. This endpoint checks that the magic link token is valid, hasn’t expired, or already been used. The provided password needs to meet our password strength requirements, which can be checked in advance with the strengthCheck method. If the token and password are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset an account password
        callback - a callback that receives an AuthResponse
      • resetByEmailCompletable

         abstract CompletableFuture<StytchResult<IAuthData>> resetByEmailCompletable(Passwords.ResetByEmailParameters parameters)

        Reset the user’s password and authenticate them. This endpoint checks that the magic link token is valid, hasn’t expired, or already been used. The provided password needs to meet our password strength requirements, which can be checked in advance with the strengthCheck method. If the token and password are accepted, the password is securely stored for future authentication and the user is authenticated.

        Parameters:
        parameters - required to reset an account password
        Returns:

        AuthResponse

      • strengthCheck

         abstract StytchResult<StrengthCheckResponse> strengthCheck(Passwords.StrengthCheckParameters parameters)

        This method allows you to check whether or not the user’s provided password is valid, and to provide feedback to the user on how to increase the strength of their password.

        Parameters:
        parameters - required to advise on password strength
        Returns:

        PasswordsStrengthCheckResponse

      • strengthCheck

         abstract Unit strengthCheck(Passwords.StrengthCheckParameters parameters, Function1<StytchResult<StrengthCheckResponse>, Unit> callback)

        This method allows you to check whether or not the user’s provided password is valid, and to provide feedback to the user on how to increase the strength of their password.

        Parameters:
        parameters - required to advise on password strength
        callback - a callback that receives a PasswordsStrengthCheckResponse
      • strengthCheckCompletable

         abstract CompletableFuture<StytchResult<StrengthCheckResponse>> strengthCheckCompletable(Passwords.StrengthCheckParameters parameters)

        This method allows you to check whether or not the user’s provided password is valid, and to provide feedback to the user on how to increase the strength of their password.

        Parameters:
        parameters - required to advise on password strength
        Returns:

        PasswordsStrengthCheckResponse