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 anything that's not in /myapp/ to the wrong place.
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
.
You can change it via :setup
option
Add the following option in your initializer:
option :request_path, 'https://yourdomain.com/auth/yourprovider/callback'
Restart you app server and try!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.