We’re upgrading an application that has two ways of authenticating users.
- Controllers that have the
before_filter :authenticate_user!callback and are accessed like a standard Rails site. - Controllers inside an API module that are accessed via JSON by client side applications. All the routes have the prefix
/api/session_id/except the authenticate action that only has the prefix/api.
Both ways authenticate the users using the User model.
Is there a way to configure devise to support them both? How?
Note: I don’t want to create users through JSON. I just want to authenticate them.
Ended up with creating a new stategy to warden.
On the
valid?method i check if theparams[:controller]comes from the api namespace.This way I didn’t touch the default devise authentication by http.