How to change route of omniauth from /auth/:provider to /myapp/auth/:provider

半城伤御伤魂 提交于 2019-12-04 00:26:44

Here is how I did this in the config.ru file. I my case, my provider is CAS.

use OmniAuth::Builder do
  configure do |config|
      config.path_prefix = '/my-app-path/auth'
  end
  provider :cas,  CAS::OPTIONS 
end

Note that CAS::OPTIONS is an array with CAS configuration for omniauth::cas. This seems to work fine. I think you will have to change the omniauth callback too : /auth/:provider/callback should be prefixed to /my-app-path/auth/:provider/callback.

Add the following option in your initializer:

option :request_path, 'https://yourdomain.com/auth/yourprovider/callback'

Restart you app server and try!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!