mikker / passwordless

🗝 Authentication for your Rails app without the icky-ness of passwords
MIT License
1.29k stars 88 forks source link

error: Missing host to link to! Please provide the :host parameter #186

Closed alexebird closed 1 year ago

alexebird commented 1 year ago

Hi and thanks for your work on this great gem.

I'm going through the initial setup on Rails 7.1.2, and I got this error:

ArgumentError (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

I think what happened is I got tripped up following the README around this line:

Also be sure to specify ActionMailer's default_url_options.host.

Instead of specifying this in config/application.rb:

config.action_mailer.default_url_options = { host: 'foo.bar' }

I got it to work by specifying this (in this case config/environments/development.rb, but probably would work in other config files):

  routes.default_url_options[:host] = 'localhost:3000'

Thank you!

mikker commented 1 year ago

Related to this https://github.com/mikker/passwordless/issues/184#issuecomment-1814225782