17
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OmniAuth関連のURLを変更する

Posted at

githubとdeveloperのproviderを使った場合の例で、デフォルトは/authなのを/loginに変更する。

config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  configure do |config|
    config.path_prefix = '/login'
  end
  provider :developer unless Rails.env.production?
  provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end

OmniAuth::Configure#path_prefix を指定する。

関連URLが/auth/github/auth/github/callbackから/login/github/login/github/callbackに変更できる。

もっと詳しく

builder内で利用できるDSLはここに定義されている。

その他のpathはOmniAuth::Strategyで生成されている。request_pathはここ。

他で上書きされていなければOmniAuth.config.path_prefixが使用される。

参考

17
17
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
17
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?