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

后端 未结 3 1708
-上瘾入骨i
-上瘾入骨i 2021-02-19 11:45

How can I change the route that triggers omniauth from using /auth/:provider to /myapp/auth/:provider ?

I don\'t want to redirect either, because my server will send any

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-19 12:40

    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.

提交回复
热议问题