Open diegossilveira opened 9 years ago
@diegossilveira did you ever figure out a path forward? Looking at some similar multi-tenant issues where user email may be tied to multiple tenants and trying to figure this out.
Is an alternate approach potentially to add a tenant_name as an extra field in the token?
Hello,
We have an application that uses devise_token_auth to accomplish token based authentication features. A new feature requires that we must have multiple users with the same email address in our database with an extra attribute that put each user in a different scope: something like a
tenant_id
.Looking at devise_token_auth code, we figured out that the only way to customize User search query is to override
sessions_controller.rb
:I believe a better approach is to define a method on the model (authentication subject) by convention and pass it all the parameters from the controller, so the query could be easily customizable. A default implementation of this method (with the current query) could be supplied on
DeviseTokenAuth::Concerns::User
.Is there a good reason for not doing so?