Devise gem: Single project with multiple login strategies

Viewed 365

I have a Rails app using device with its default login strategy (e-mail/password) for a specific model (Admin). Admins can login through the /admin route.

Now I want to allow my mobile app users (User model) to login through the /user route with a different login strategy: passwordless login method with email or phone and verification code.

Is it possible to setup different login strategies for different routes in a single Rails app?

1 Answers

yes.

in application_controller you can list the available devise user groups like

  devise_group :human, contains: [:user, :admin, :guest]

https://github.com/yshmarov/myclass103 - here's an example of an app using this strategy

Related