Closed TMJEngineers closed 5 years ago
If you look at it closely, this is not a bug.
Your user login with an id
of 1
let's say. Now you are asking both the authenticators, admin
and user
to find a user by querying the database for id=1
.
If user for id=1
exists in users
and also in admin
table, that means they are logged in.
Also I don't understand the point of creating 2 users table. Ideally admin
is a different role for the user and creating multiple tables for different roles will not help much
hi @thetutlage thank you for your reply, I think I understand the authenticators in a wrong way. I just want to know how do you handle different authentication in different database or table in adonis correctly? or is it supported?
On our end we have many reason why separate 2 tables but the summary of it is to simplify the process of fetching 2 type of users and to prevent other dev's specially newly joined dev from making a mistake on fetching users since the access level of each is crucial to the security of the application.
Closing since issue hasn't been active for a while. Feel free to create a new one if needed.
Hi,
I have notice that upon logging in on our
admin
auth it also fills in ouruser
auth with the sameid
of the logged user. I have tested it on a fresh adonis setup to validate my claim. This is what I did and what is the result of it.config/auth.js
Route
I only logged the auth of
admin
and console the both authenticator and these were the result.Console
Please see the
id
in $attributesDid I use the authenticator the right way?