A simple Login with gmail account, built with Ruby on Rails
Social login is the concept of using a third-party like Google, Facebook, or Twitter to authenticate and store users in your web application. In shorts we can say that users who have accounts on the aforementioned sites, and more, can access your application
without having to create a separate account. Today, in this era every person uses the social login, and they don’t want to waste time in creating accounts or filling details etc.
Existing guides either used older versions of Ruby, had missing features such as authenticated routes, or had lots of unnecessary code.
Devise with Omniauth Gem
I would recommend reading that to get an overview.Setting up omniauth with Google is very similar.
⚠️ In the blog, the gem is omniauth . One might assume the keyword used for Google is google. There are some changes in the versions of gem files therefore people are facing the problems in login with google.
gem ‘devise’, ‘~> 4.3.0’
gem ‘omniauth-google-oauth2’, ‘~> 0.8.0’
How to solve the issue with Omniauth.
A lot of people are finding issues with login with omniauth. The issue is arising due the oldest version of the omniauth gem file so they can fix the issue by updating the gem file.
What should we not to do
If you are working with ruby old versions and trying to add the omniauth gem with latest version and updating the gem file by using bundle update command so it can give the more issue because bundle update, actually update the all the gem for the application
If you try the bundle install for the only omniauth gem, we will say it is also a bad habit because it again installs the gem from the starting and sometimes gems are not able to install properly with the mentioned versions.
What is the best way to install the gem with latest versions
As per our knowledge, we would like to say that you should update the gem file with a separate command which is the only use for that gem.
You can use the following commands for updating the omniauth gem files.
gem install omniauth-google-oauth2 -v 0.8.0
#one more command you can use the updating the gem
gem update omniauth-google-oauth2
The last command will update the latest gem by itself, there is no need to mention the version.