Database Administrators Asked on December 12, 2021
I’m currently having a case where a user has to verify their email, is able to reset his password and can log into a web-interface (so far and not limited to). There a now 3 places where some kind of token is used to give a user access to a specific action.
So far I’ve come up with two possible solutions:
There will be a web_session
, email_verified
and password_reset
table.
Pros:
Cons:
id
, user_id
, token
, created_at
)type
/ role
column:There’s just one table with id
, user_id
, token
, created_at
and type
(enum) – type
can in this case be all sorts of access-type, in our case api-session
, email-verification
and password-reset
. (Of course this could be improved in a way that a token will give general access to a specific thing)
Pros:
Cons:
type
Is there a generally preferred way of doing this (I’m using mariadb if that’s important) / is there a third, better way of doing it? Or does it really not matter that much and I’m just overthinking it?
I tried to find existing schemes / db-designs but I couldn’t find anything useful as there is afaik no name for this whole thing (please tell me I’m wrong and I just cannot search correctly).
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP