Implementing auto login on 'confirmation mail click' with Devise
<p>We use devise on our rails app in order to deal with sign-in and authentication. Basically, the process is quite straightforward: you sign up, get the confirmation email with the link pointing to a route such as path/page/confirm/token. Once authenticated, the user is redirected to page/login in order to enter his login/password and access the service. </p>

<p>Right now, we would like to login automatically the user that clicks this link right after he reaches the page/confirm/token. </p>

<p>I've been investigating, and it seems like a method that was initially used by people after devise 3.1 to have this behavior:</p>

<pre><code>config.allow_insecure_sign_in_after_confirmation = true
</code></pre>

<p>I was planning to use this in the initializers/devise.rb, but unfortunately it also seems like it have disappear from devise methods, I ran these commands on console to check:</p>

<pre><code>gem install devise
pry
require 'devise'
Devise.methods
</code></pre>

<p>... no <code>allow_insecure_sign_in_after_confirmation</code> method there.</p>

<p>I might try to do this manually in the confirmation controller with something custom like: </p>

<pre><code>def show 
  u = User.find_by(confirmation_token: params[confirmation_token])
  sign_in(u)
end
</code></pre>

<p>But unfortunately, again, it's not working as expected. </p>

<p>Any input is appreciated.</p>