User architecture #88
-
While creating a new user or while logging in, the api has to go through the authentication process. What is the logic behind that? How to tackle it? Can someone help me understand the user architecture? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Authentication verifies a user's identity during login by comparing the provided password with the hashed password in the database using bcrypt.compare. If the password is correct, the server generates a JWT token containing the user's ID, roles, and other claims. Each time the token is sent with an API request, a middleware checks the token's validity. If the token is valid, the user is granted access; otherwise, access is denied. Hope this clarification helps ! |
Beta Was this translation helpful? Give feedback.
Authentication verifies a user's identity during login by comparing the provided password with the hashed password in the database using bcrypt.compare. If the password is correct, the server generates a JWT token containing the user's ID, roles, and other claims.
Each time the token is sent with an API request, a middleware checks the token's validity. If the token is valid, the user is granted access; otherwise, access is denied.
Hope this clarification helps !