Developer Notes

Upgrading to OmniAuth 2.0 in Ruby on Rails application

When upgrading to OmniAuth 2.0 in your Ruby on Rails application, you might encounter a new error in your browser saying:

Not found. Authentication passthru.

In your Rails application log, you will see the following error:

DEBUG -- omniauth: (google_oauth2) Request phase initiated.
WARN -- omniauth: Attack prevented by OmniAuth::AuthenticityTokenProtection
ERROR -- omniauth: (google_oauth2) Authentication failure! authenticity_error: OmniAuth::AuthenticityError, Forbidden

To resolve this issue, install the omniauth-rails_csrf_protection gem:

gem 'omniauth-rails_csrf_protection'

Then, make sure to use HTTP method POST when initiating authentication. If you are using a link, you can set the HTTP method to POST like this:

link_to "Login with #{provider}", omniauth_authorize_path(resource_name, provider), method: :post

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Articles

Want your website to turn up in Google Search results? You can submit your website for indexing in Google Search
Occasionally, we need to bring our website visitors to a maintenance page. Don't worry, you can spin up a Maintenance
When you are deploying changes to a WordPress website, you might encounter an error about PHP's upload_max_filesize. Here is one
After installing Android Studio in Ubuntu, you might experience getting a blank screen instead of the Android Studio Setup Wizard.
It might surprise you how much storage space Snap packages use. You will most likely find that your Snap packages
The Loop Grid widget allows you to set the total number of items to load and display in the Loop

Recent Articles

Topics

Related Topics