You are currently viewing the new Anvil Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the new Anvil Editor Docs

anvil.users.mfa Module

Functions

add_mfa_method(password, mfa_method, [clear_existing=False])

Add an MFA method to the current user by passing the user’s password and the mfa method, optionally clearing all existing methods.


    check_twilio_token(mfa_method, token)

    Validate the given Twilio Verify token against the given MFA method from a User row.


      configure_mfa_with_form([allow_cancel=False])

      Display a form for the user to configure 2-factor authentication.

      allow_cancel: if True, the signup form has a Cancel button that the user can use to dismiss the form.


        create_fido_mfa_method(email_address)

        Generate a WebAuthn challenge that can be used to register a new hardware token for two-factor authentication.


          generate_totp_secret(email_address)

          Generate a TOTP secret that can be added as two-factor authentication for the current user.


            generate_twilio_mfa_method(phone)

            Generate a Twilio MFA method from the provided phone number.


              get_available_mfa_types(email_address, password)

              Get the available MFA types for the given user by passing their email and password.


                get_enabled_mfa_types()

                Get all the enabled MFA types for this app.


                get_fido_mfa_login(email_address, password)

                Generate a WebAuthn challenge that the given user can use to log in with a previously registered hardware token.


                  get_totp_mfa_login(code)

                  Get an MFA login object representing a TOTP login code. This can be passed to the login_with_email function as the mfa argument.


                    get_twilio_mfa_login(code)

                    Get an MFA login object representing a Twilio Verify token. This can be passed to the login_with_email function as the mfa argument.


                      mfa_login_with_form(email_address, password)

                      Display a form to collect two-factor authentication credentials from the user currently logging in by passing the function their email and password.


                        send_twilio_token(mfa_method, channel)

                        Send a Twilio Verify token using the given MFA method from a User row.


                          validate_totp_code(mfa_method, code)

                          Validate the given TOTP code against the given MFA method from a User row.



                            Do you still have questions?

                            Our Community Forum is full of helpful information and Anvil experts.


                            anvil.users.mfa