I’m following the tutorial below, but I get an error.
error:
No route matches [POST] “/auth/auth0”
version:
$ gem list | grep omniauth
omniauth (1.9.1)
omniauth-auth0 (1.4.2)
omniauth-oauth2 (1.3.1)
omniauth-rails_csrf_protection (0.1.2)
$ ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-darwin21]
$ rails -v
Rails 4.2.11.3
<-- app/views/xxx/xxx.haml -->
= link_to 'Login', '/auth/auth0', method: :post
<-- config/initializers/auth0.rb -->
require 'omniauth'
require 'omniauth-auth0'
AUTH0_CONFIG = Rails.application.config_for(:auth0)
Rails.application.config.middleware.use OmniAuth::Builder do
provider(
:auth0,
AUTH0_CONFIG['auth0_client_id'],
AUTH0_CONFIG['auth0_client_secret'],
AUTH0_CONFIG['auth0_domain'],
callback_path: '/auth/auth0/callback',
authorize_params: {
scope: 'openid profile'
}
)
end
<-- config/routes.rb -->
get '/auth/auth0/callback' => 'auth0#callback'
get '/auth/failure' => 'auth0#failure'
get '/auth/logout' => 'auth0#logout'
Please help!