Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devise_twilio_two_factor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devise_twilio_two_factor

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Devise Twilio Two Factor

The "Devise Twilio Two-Factor Authentication Gem" is an integration solution that brings together the robust security features of the Devise gem and the reliable functionality of Twilio APIs. With this solution, incorporating two-factor authentication for user authentication in your application has never been easier. By leveraging the power of Devise and Twilio together, your application can offer enhanced security measures to your users, reducing the likelihood of unauthorized access and potential data breaches.

Installation

Add devise_twilio_two_factor to your Gemfile with:

# Gemfile

gem 'devise_twilio_two_factor', '~> 0.1.0'

Usage

To integrate the Devise Twilio Two-Factor Authentication Gem, you'll need:

  • The Devise gem, set up according to their instructions.
  • A Twilio account with the account_sid and auth token from the console.
  • A Verify Service with its ID.

Add them to your devise.rb

  config.twilio_account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  config.twilio_auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  config.twilio_verify_service_sid = "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

From here, the generator should get you the rest of the way (you can skip the rest of the section):

./bin/rails generate devise_two_factor MODEL

To add two-factor authentication to a model, simply add the Devise Twilio Two-Factor Authenticatable module and specify two options:

  1. The otp_destination option should represent the field containing the phone number or email address where the OTP code will be sent.
  2. The communication_type option should be set to either "sms" or "email" depending on the desired mode of communication.

Ex. for a user with a phone field -> user.phone = '+18001234567'

  devise :twilio_two_factor_authenticatable, otp_destination: 'phone', communication_type: "sms"

lastly, just create a migration to add otp_required_for_login:boolean to the table of the resource you wish to add 2fa to.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/devise_twilio_two_factor.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 28 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc