2 years ago

#41541

test-img

Aishwarya Jayakumar

Is there any way to allow generate_otp_backup_codes using validate_and_consume_otp?

I am using device-two-factor gem for otp generation in rails. I am using generate_otp_backup_code to a specific user for testing purpose which is generating otp successfully. validate_and_consume_otp allows otp created via generate_otp_secret whereas validate_and_consume_otp dosen't allow the backup code otp to login.

Is there any way to allow generate_otp_backup_codes via validate_and_consume_otp?

tinfoil /devise-two-factor
gem 'devise-two-factor'

In user.rb

devise  :two_factor_authenticatable,
otp_secret_encryption_key:Rails.application.secrets.secret_key_base
devise :two_factor_backupable, otp_backup_code_length:     6,
            otp_number_of_backup_codes: 10

To generate backup codes:

codes = current_user.generate_otp_backup_codes!
current_user.save!

reactjs

ruby-on-rails

ruby

ruby-on-rails-3

0 Answers

Your Answer

Accepted video resources