繁体   English   中英

如何通过omniauth更改/ auth /:provider路径

[英]How to change /auth/:provider path by omniauth

为了删除控制器的名称,我在routes.rb中这样写。

get "/:user_id/:id", :to => "words#show", :as => :short_user_word

它工作正常,但是当我尝试使用omniauth的路径“ / auth /:provider /”时,第一个路由会覆盖omniauth的路径。

Omniauth回调网址可用于以下路由。

get '/auth/:provider/callback' => 'authentications#create'

我也想设置路径“ / auth /:provider /”,但是我不知道该怎么写。

我已经阅读了此问题和答案,但找不到如何使用:setup选项。

如何将omniauth的路由从/ auth /:provider更改为/ myapp / auth /:provider

如何避免这个问题?

您的路线顺序必须如下所示

get '/auth/:provider/callback' => 'authentications#create'
get "/:user_id/:id", :to => "words#show", :as => :short_user_word

所以首先如果找到/ auth /:provider,则选择此路由,否则,如果获取您的正常路由

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM