← Back to Upcase

Devise token and standard authentication in same rails app


(Nicolo) #1

I have a rails api I setup which uses https://github.com/gonzalo-bulnes/simple_token_authentication for authentication of users. I’m trying to add in admin dashboard and want to authenticate admins (could be a separate model or flag on the user model) via standard email/username and password authentication.

Is there a way to setup Devise to do this or do I need to use token authentication for my admin dashboard?

It seems like there is just one devise configuration file that is universal for the application. I’m not sure how to configure devise to work with both forms of authentication.

Thanks in advance.


(Nicolo) #2

I think I figured out a solution.

I setup devise for an admin model along with my current user model. I was able to specify different authentication keys for my admin model via the description in the article http://excid3.com/blog/devise-username-authentication-with-multiple-models-and-subdomains/