TIL: How to integrate Doorkeeper with Passwordless

--

This is just a quick post about how to integrate Doorkeeper with Passwordless in Rails.

The Doorkeeper documentation shows the standard Devise configuration, which is shown below:

Doorkeeper.configure do
resource_owner_authenticator do
current_user || warden.authenticate!(scope: :user)
end
end

Here are the changes needed to make it work with Passwordless, assuming you have a current_user method in ApplicationController:

Doorkeeper.configure do
resource_owner_authenticator do
current_user
end
end

So why does this work? Well, Doorkeeper::ApplicationController inherits from your ApplicationController by default and so we have access to all the methods from our ApplicationController.

The same is true for admin_authenticator.

Happy coding!

--

--

Henrik Hauge Bjørnskov
Henrik Hauge Bjørnskov

Written by Henrik Hauge Bjørnskov

I build stuff at Relatel A/S, vivid traveller and gear junkie.

No responses yet