LoginSignup
12
8

More than 3 years have passed since last update.

SNS認証ログインでNot found. Authentication passthru.が表示されたときの対処方法

Last updated at Posted at 2020-03-24

執筆背景

先日、個人アプリ(フレームワークにはRuby On Railsを使用)をリモートリポジトリーにプッシュした際GitHubからgem "OmniAuth"の脆弱性について指摘された。
詳細 → https://github.com/omniauth/omniauth/pull/809

そのため、それに対応するgem "omniauth-rails_csrf_protection"をインストールした。

Gemfile
gem 'OmniAuth' #削除
gem 'omniauth-rails_csrf_protection' #追加
$bundle install

ローカル上でアプリを再起動すると以下のようなエラーが発生したため、対処方法を示す。

スクリーンショット 2020-03-25 1.27.30.png

対処方法

SNS認証ログインのlink_toタグの後ろにmethod: :postを追記する。

_links.html.erb
  <%= link_to (omniauth_authorize_path(resource_name, provider)), method: :post do %>
 SNS認証ログイン
  <% end %>

link_toタグは、ログイン機能にgem deviseを使用している場合、app/views/devise/shared/_links.html.erbの中にあります。

12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8