I have a project using devise_token_auth for authentication. I have installed Active Admin following this.
When I try to access localhost:3000/admin I get You need to sign in or sign up before continuing.
However, when I comment config.authentication_method = :authenticate_admin_user! in config/initializers/active_admin.rb, localhost:3000/admin opens the dashboard page.
My question is why am I not getting the login page for active admin?
There are several things that you need to know when working with both
ActiveAdmin(AA) anddevise_token_auth. AA uses:Devisefor authentication:adminas default namespaceIt means that all of your AA resources will have routes under
/admine.g./admin/postsand they will be authenticated usingDevise; notdevise_token_auth.In order to avail both types of authentication system, you must use two namespaces: one for AA and one for devise_token_auth.
A common strategy in this scenario would be to define AA routes before devise_token_auth like so:
Here AA is using
:admin_usersand token_auth will use:userstable. Don't forget to adapt them to your needs.Note: If you ever face trouble with your
ApplicationControllerwhile working with AA and devise_token_auth, please refer to this link.