The Recovery Codes Recover method wraps the Recovery Codes Recover API endpoint. It takes a single recovery_code parameter, which is a recovery code that was previously generated for the Member. Calling the recover endpoint will consume the recovery code and authenticate the Member, minting a new session for them.
Currently, recovery codes are only generated when a Member enrolls in TOTP as their secondary MFA factor, and as such authenticate members in place of a stytch.totps.authenticate().
If neither a Member Session nor an intermediate session token is present, this method will fail.
If this method succeeds, the Member will be logged in, granted an active session, and the session cookies will be minted and stored in the browser.
You can listen for successful login events anywhere in the codebase with the stytch.session.onChange() method or useStytchMemberSession hook if you are using React.