{"id":11179,"date":"2020-07-07T11:25:40","date_gmt":"2020-07-07T05:55:40","guid":{"rendered":"https:\/\/www.botreetechnologies.com\/blog\/?p=11179"},"modified":"2021-10-18T18:58:15","modified_gmt":"2021-10-18T13:28:15","slug":"devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app","status":"publish","type":"post","link":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/","title":{"rendered":"Two Factor Authentication using Devise gem in Rails 6 Application"},"content":{"rendered":"\n<p>Logging in into an application becomes convenient with a mobile number. You just have to enter your mobile number, get an OTP and there you go &#8211; you are logged in.<\/p>\n\n\n\n<p>Mobile-based login reduces the hassle of remembering the password for your account in the application. It is also a secure method as someone can steal your password and access your account. <\/p>\n\n\n\n<p>Your mobile number is with you and only you will receive the OTP for logging in. This feature is also available in a Rails application with the help of a simple gem.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ruby on Rails App: Devise gem Integration<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Devise login:<\/h3>\n\n\n\n<p><a href=\"https:\/\/github.com\/heartcombo\/devise\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Devise<\/a> is a flexible authentication solution for Rails development based on Warden.<\/p>\n\n\n\n<p>Generally, devise uses email and password for login, but there may arise a situation where you want to login using a mobile number and password. <\/p>\n\n\n\n<p>Here\u2019s how to implement devise in such a situation.<\/p>\n\n\n\n<p>You can hire Ruby on Rails developers to add the devise two factor authentication feature.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Also Read: <strong>A&nbsp;<\/strong><a href=\"https:\/\/www.botreetechnologies.com\/blog\/guide-to-hiring-ruby-on-rails-developers\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Complete Guide to Hiring Ruby on Rails Developers<\/strong><\/a><strong>&nbsp;in 2021<\/strong><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">How to login using a mobile number in a Rails Application with devise?<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Login using the actual attribute<\/strong><\/h2>\n\n\n\n<p>Devise allows you to login using email and password, a kind of two-factor authentication (2FA) in a Rails application.<\/p>\n\n\n\n<p>There may arise a situation to login using a mobile number or username rather than an email address.<\/p>\n\n\n\n<p>There are 2 ways in which we can use Devise with two-factor authentication using actual attributes to login to the application. Here is the devise set up and working for both the methods.<\/p>\n\n\n\n<p><strong>1.Having one devise model in the application.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Add the below code snippet to devise.rb file.<\/li><\/ul>\n\n\n\n<p><code>config.authentication_keys = [:mobile_no]<\/code><\/p>\n\n\n\n<p><strong>2. Having multiple devise models in the application.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Add the below code snippet to devise_model.rb.<\/li><\/ul>\n\n\n\n<p><code>devise: authentication_keys: [:mobile_no]<\/code><\/p>\n\n\n\n<p><em>Note: Also make the required changes in devise views.<\/em><\/p>\n\n\n\n<p>Add the below code snippet to devise_model.rb, skip the devise two-factor-gem email validation:<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/HunnyJummani\/be1dae0d3d42384172bf3ae01763c584.js\"><\/script><\/p>\n\n\n\n<p>Simple!! Right. Now you can log in to the application using a mobile number instead of email &#8211; all because of the Rails two-factor authentication feature.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"186\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/simple-right.gif\" alt=\"devise two_factor_authentication gem\" class=\"wp-image-13219\"\/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Login using virtual attribute:<\/h2>\n\n\n\n<p>There may arise a situation where we want to log in to the application using email or username both attributes to login to the application with Rails devise-two-factor authentication.<\/p>\n\n\n\n<p><em>Note: Here, we are going to log in using username or email, you can change the attribute as per your requirement.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Steps to follow:<\/strong><\/h3>\n\n\n\n<p>1. Add the username field to users table using migration as shown below:<\/p>\n\n\n\n<p><code>rails g migration AddUsernameToUser username<\/code><\/p>\n\n\n\n<p>2. Add strong parameters <code>(username, email, password, password confirmation and remember me)<\/code> to <code>configure_permitted_parameters<\/code> as shown below:<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/HunnyJummani\/85318b6ff2464e67e00b2daa3c03bd9d.js\"><\/script><\/p>\n\n\n\n<p>3. Create a login virtual attribute in the devise model.<\/p>\n\n\n\n<p>Add login as an attribute accessor in devise model<br><code>attr_accessor :login<\/code><\/p>\n\n\n\n<p><code>def login<br>\n@login || self.username || self.email<br>\nend<\/code><\/p>\n\n\n\n<p>4. Add authentication_keys to devise model as shown above(log in using the actual attribute).<\/p>\n\n\n\n<p>5. Override the warden conditions in <code>devise_model.rb<\/code>.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/HunnyJummani\/be1dae0d3d42384172bf3ae01763c584.js\"><\/script><\/p>\n\n\n\n<p>Hold ON!!!, You need to change the name for email to login attribute in HTML views as shown below in <code>sessions\/new.html.erb<\/code>:<\/p>\n\n\n\n<p><code>&lt;%= f.label :login %&gt;&lt;br \/&gt;<\/code><br><code>&lt;%= f.text_field :login, autofocus: true, autocomplete: \"Username\" %&gt;<\/code><\/p>\n\n\n\n<p>Now, you can try to login using email\/username and password in the application.<\/p>\n\n\n\n<p>Hurray!! It\u2019s done.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to send, verify, and retry OTP?<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What is OTP?<\/h3>\n\n\n\n<p>OTP stands for One-Time-Password. An automatically generated numeric or alphanumeric string of characters used for user authentication. Rails devise-OTP authentication is a feature that can help with that.<\/p>\n\n\n\n<p>In one of the recent Ruby on Rails projects, we required a functionality where a user can log in using a mobile number and password with the OTP verification.<\/p>\n\n\n\n<p>The OTP functionality was handled using the <a href=\"https:\/\/github.com\/MSG91\/sendotp-ruby\">send_otp<\/a> gem, which allows you to send, verify and retry sending the previous OTP.<\/p>\n\n\n\n<p>How to use send_otp gem in rails project?<\/p>\n\n\n\n<p><strong>Step 1: Add the send_otp gem to the Gemfile.<\/strong><\/p>\n\n\n\n<p><code>gem&nbsp; 'send_otp'<\/code><\/p>\n\n\n\n<p><strong>Step 2: Install all the dependencies.<\/strong><\/p>\n\n\n\n<p><code>bundle install<\/code><\/p>\n\n\n\n<p><strong>Step 3: Create an account on <a href=\"https:\/\/msg91.com\/\">MSG91<\/a> and get the SenderID, Auth_Key.<\/strong><\/p>\n\n\n\n<p><strong>Step 4: Create a service for implementing the OTP functionality as shown <a href=\"https:\/\/gist.github.com\/HunnyJummani\/662a3dfaada86dbe9a90cf2f56e4d9a9\">here<\/a>.<\/strong><\/p>\n\n\n\n<p>Note: The code is written on the basis of the service created previously in step 4.<\/p>\n\n\n\n<p><strong>Step 5: Send OTP to a mobile number.<\/strong><\/p>\n\n\n\n<p>The below code snippet will send OTP to the phone_no you entered via SMS with the SENDER_ID you configured on the MSG91 platform.<\/p>\n\n\n\n<p><code>Otp.new(phone_no).create<\/code><\/p>\n\n\n\n<p><strong>Step 6: Verify OTP.<\/strong><\/p>\n\n\n\n<p>This call of the service will verify the OTP sent on the phone_no you passed as a parameter in this service. This will return either true or false for OTP verification.<\/p>\n\n\n\n<p><code>Otp.new(phone_no).verify<\/code><\/p>\n\n\n\n<p><strong>Step 7: Retry sending OTP.<\/strong><\/p>\n\n\n\n<p>Due to some technical reasons, the OTP may not be received to the phone number you entered, in that case, you can retry sending the OTP. Use the following code snippet for the same.<\/p>\n\n\n\n<p><code>Otp.new(phone_no).retry<\/code><\/p>\n\n\n\n<p><em>Note: Set retry_voice false if you want to retry OTP via text, the default value is true.<\/em><\/p>\n\n\n\n<p>For more detailed usage visit the <a href=\"https:\/\/github.com\/MSG91\/sendotp-ruby\">gem<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Amazing Facts:<\/h3>\n\n\n\n<p><strong>You can retry sending OTP for a maximum of 2 attempts.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Keep Reading: <a href=\"https:\/\/www.botreetechnologies.com\/blog\/password-protected-zip-using-ruby-on-rails\/\">Password Protected Zip Using Ruby on Rails<\/a><\/strong><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.botreetechnologies.com\/ruby-on-rails-development\">Integrating the devise RubyGem in your Ruby on Rails application<\/a> is an easy task. While not every Ruby on Rails project calls for mobile login, it would come in handy if you want a more secure login feature.<\/p>\n\n\n\n<p>A Ruby on Rails consulting company can help to integrate Rails devise-OTP authenticaltion and two-factor-authentication feature in your app.<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/www.botreetechnologies.com\/contact\" target=\"_blank\" rel=\"noopener noreferrer\">Consulting is free<\/a>&nbsp;\u2013 let us help you grow!<\/strong><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Logging in into an application becomes convenient with a mobile&#8230;<\/p>\n","protected":false},"author":56,"featured_media":13221,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,10],"tags":[],"class_list":["post-11179","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-on-rails","category-technology"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Devise Gem for Login Using a Mobile Number in Ruby on Rails App<\/title>\n<meta name=\"description\" content=\"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Devise Gem for Login Using a Mobile Number in Ruby on Rails App\" \/>\n<meta property=\"og:description\" content=\"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\" \/>\n<meta property=\"og:site_name\" content=\"BoTree Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BoTreeTechnologies\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T05:55:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-18T13:28:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Hunny Jummani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:site\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hunny Jummani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\"},\"author\":{\"name\":\"Hunny Jummani\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e\"},\"headline\":\"Two Factor Authentication using Devise gem in Rails 6 Application\",\"datePublished\":\"2020-07-07T05:55:40+00:00\",\"dateModified\":\"2021-10-18T13:28:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\"},\"wordCount\":878,\"commentCount\":7,\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg\",\"articleSection\":[\"Ruby on Rails\",\"Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\",\"name\":\"Devise Gem for Login Using a Mobile Number in Ruby on Rails App\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg\",\"datePublished\":\"2020-07-07T05:55:40+00:00\",\"dateModified\":\"2021-10-18T13:28:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e\"},\"description\":\"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg\",\"width\":1920,\"height\":1280,\"caption\":\"devise gem authentication\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.botreetechnologies.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Two Factor Authentication using Devise gem in Rails 6 Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/\",\"name\":\"BoTree Technologies\",\"description\":\"Committed to inspire generation.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e\",\"name\":\"Hunny Jummani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png\",\"caption\":\"Hunny Jummani\"},\"description\":\"I am a Ruby On Rails Developer. I love JavaScript, logical problem solving in Ruby and exploration of new things. Apart from coding, I also like to travel, listen music and play guitar.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Devise Gem for Login Using a Mobile Number in Ruby on Rails App","description":"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/","og_locale":"en_US","og_type":"article","og_title":"Devise Gem for Login Using a Mobile Number in Ruby on Rails App","og_description":"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.","og_url":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/","og_site_name":"BoTree Technologies","article_publisher":"https:\/\/www.facebook.com\/BoTreeTechnologies\/","article_published_time":"2020-07-07T05:55:40+00:00","article_modified_time":"2021-10-18T13:28:15+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg","type":"image\/jpeg"}],"author":"Hunny Jummani","twitter_card":"summary_large_image","twitter_creator":"@BoTreeTech","twitter_site":"@BoTreeTech","twitter_misc":{"Written by":"Hunny Jummani","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#article","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/"},"author":{"name":"Hunny Jummani","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e"},"headline":"Two Factor Authentication using Devise gem in Rails 6 Application","datePublished":"2020-07-07T05:55:40+00:00","dateModified":"2021-10-18T13:28:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/"},"wordCount":878,"commentCount":7,"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg","articleSection":["Ruby on Rails","Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/","url":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/","name":"Devise Gem for Login Using a Mobile Number in Ruby on Rails App","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage"},"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg","datePublished":"2020-07-07T05:55:40+00:00","dateModified":"2021-10-18T13:28:15+00:00","author":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e"},"description":"Ruby on Rails App can allow users to login using a mobile number through the devise RubyGem. Here are the steps to integrate devise in your RoR project.","breadcrumb":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#primaryimage","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/devise-gem-for-login-using-a-mobile-number.jpg","width":1920,"height":1280,"caption":"devise gem authentication"},{"@type":"BreadcrumbList","@id":"https:\/\/www.botreetechnologies.com\/blog\/devise-gem-authentication-login-using-mobile-number-in-ruby-on-rails-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.botreetechnologies.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Two Factor Authentication using Devise gem in Rails 6 Application"}]},{"@type":"WebSite","@id":"https:\/\/www.botreetechnologies.com\/blog\/#website","url":"https:\/\/www.botreetechnologies.com\/blog\/","name":"BoTree Technologies","description":"Committed to inspire generation.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/0d616df8a58c8145fae7ceb8d048e23e","name":"Hunny Jummani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/hunny-jummani-150x150.png","caption":"Hunny Jummani"},"description":"I am a Ruby On Rails Developer. I love JavaScript, logical problem solving in Ruby and exploration of new things. Apart from coding, I also like to travel, listen music and play guitar."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/11179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=11179"}],"version-history":[{"count":4,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/11179\/revisions"}],"predecessor-version":[{"id":16578,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/11179\/revisions\/16578"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media\/13221"}],"wp:attachment":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=11179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=11179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=11179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}