I have seen this issue get brought up in other posts, but I cannot find a way to remedy it with my app. I keep getting this error when I click on “login” rather than being directed to a login page. I don’t know where the issue can be, as I followed the documentation very carefully. Below are my routes:
Rails.application.routes.draw do
get "dashboard/show"
root "home#show"
get "home/show"
resources :saved_games
resources :saved_videos
resources :saved_quotes
resources :games
resources :videos
resources :users
resources :quotes
get "auth/auth0/callback" => "auth0#callback"
get "auth/failure" => "auth0#failure"
# post "auth/auth0" => "dashboard#create"
get "dashboard" => "dashboard#show"
get "/quotes" => "quotes#index"
get "/quotes/:id" => "quotes#show"
get "/games" => "games#index"
get "/quotes/:id" => "games#show"
get "/videos" => "videos#index"
get "/videos/:id" => "videos#show
end
my auth0.rb:
Rails.application.config.middleware.use OmniAuth::Builder do
provider(
:auth0,
"AUTH0_CLIENT_KEY",
"AUTH0_CLIENT_SECRET",
"almanac.auth0.com",
callback_path: "/auth/auth0/callback",
authorize_params: {
scope: "openid email profile",
},
)
end
IIRC, for Rails there’s a recommendation that the login action should be an HTTP POST (Auth0 Ruby On Rails SDK Quickstarts: Login) instead of a GET so it’s somewhat unexpected for the error to mention the GET verb. How are you implementing the login action?
I am wondering if I am missing some obvious step? I saw in another troubleshooting question that the login route is something the omniauth gem should set up by default, however I do not get rerouted to login when I click on the link.
Have you already tried with a button_to instead of a link_to? The code sample in the linked I mentioned before uses button_to although I’m now noticing that a warning panel in the quickstart does mention the link_to which is confusing. Let me know if button_to improves the situation as if it does and the issue is in the link_to we need to fix the quickstart info.