Authful Ruby Client

Makes integration with 2fa as simple as possible. This gem interacts with the open-sourced Authful service for 2fa.


Add this line to your application's Gemfile:

gem 'authful'

And then execute:

$ bundle

Or install it yourself as:

$ gem install authful


To use, you will need an Authful endpoint. You will need to install it, or if a successful project, you will probably find Authful endpoint as a service.

To configure the gem, use:

Authful.configure do |c|
  c.endpoint = "https://<myendpoint>" 
  c.api_key  = "<my api key>"

res = Authful.enroll("[email protected]")
res.qr_code # use this to display the QR code for the user signup
res.token   # You will want to save this token to your application, it is
            # the user's primary key to the authful service.  It is **not**
            # the secret token used to generate OTP.

Authful.set_phone("token", "12005551212") # sets the users phone number

Authful.send_sms("token") # sends sms token

Authful.validate("token", "000000") # validates OTP token

res = Authful.reset("token") # Resets the users secret
res.qr_code # use this to display the new QR code for the user

Authful.unenroll("token") # Remove user from Authful service


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request